Blockie

This program allows you to paint coloured squares on the screen using the cursor keys.  It is essentially a very simple drawing program within a few lines of code.

There are options for choosing the size of the blocks and the colour.  There is loads of scope to change the program to make a more sophisticated drawing package - enjoy!

UPDATE 2015-05-05: Download the Windows executable version.
 




      
      REM the blockie graphix
      REM Tim Goliath Street
      REM 11/10/2012
    
      REM screen parameters
      X_WIDTH% = 1920
      Y_WIDTH% = 1520
    
      ON ERROR RUN
    
      MODE 12  : OFF
    
    
    
      REM set the graphics cursor to somewhere in the middle of the screen
      x% = X_WIDTH% DIV 2
    
      y% = Y_WIDTH% DIV 2
    
    
    
      REM display instructions
      *font Courier New, 40b
      PRINT " BLOCKIE GRAPHIX"
      *font Courier New, 12
      PRINT "  By Mr Street"'
      *font Courier New, 20b
      PRINT " INSTRUCTIONS"
      *font Courier New, 12
      PRINT "  Use the CURSOR KEYS to move."
      PRINT"  Press 1-9 for different colours"
      PRINT"  Press SPACE for no colour"
      PRINT"  Press DELETE to, erm... delete"
      PRINT
      PRINT"    (Press any key)"''
      g% = GET
    
      REPEAT
        INPUT "  Enter block size (5-100) : " diam%
      UNTIL diam%>=10 AND diam% <=100
    
      diam% *= 2 : REM even numbers are best!
      CLS
    
    
      REM start with a random colour
      currentCol% = RND(8)
    
      REM MAIN LOOP
      REPEAT
        REM display the cursor
        GCOL 7
        RECTANGLE x%,y%,diam% , diam%
      
        REM get user input
        g% = GET
      
        REM remove the cursor
        GCOL 0
        RECTANGLE x%,y%,diam% , diam%
      
      
        REM process user input
        CASE g% OF
          
          WHEN 136
            REM left
          
            IF x%>diam% THEN
              x% -= diam%
            ENDIF
          
          WHEN 137
            REM right
          
            IF x%<X_WIDTH% THEN
              x% += diam%
            ENDIF
          
          WHEN 138
            REM down
            REM left
            IF y%>0 THEN
              y% -= diam%
            ENDIF
          
          WHEN 139
            REM up
            REM right
            IF y%<Y_WIDTH% THEN
              y% += diam%
            ENDIF
          
          WHEN 135, 8
            REM delete, backspace
            currentCol% = 0 : REM set to black
          
          WHEN 32
            REM space
            currentCol% = -1 : REM no colour
          
          WHEN 49,50,51,52,53,54,55,56,57,58
            currentCol% = g%-48
          
        ENDCASE
      
      
        REM draw a rectangle in the current colour
        IF currentCol% <> -1 THEN
          GCOL currentCol%
          RECTANGLE FILL x%, y%, diam% , diam%
        ENDIF
      UNTIL FALSE