This program generates a pattern based on coloured triangles. Use the cursor keys to draw the next triangle.
MODE 10 : OFF
REM get size from user
REPEAT
PRINT "Press cursor keys to move!"
INPUT "Enter size (10 - 250) : " size%
CLS
UNTIL size% >= 10 AND size% <= 250
REM start position
x% = 720
y% = 576
MOVE x%, y%
MOVE x%,y%
PLOT 85, x%, y%
REM main loop
REPEAT
REM get a key press from the user
key% = GET
REM which key did they press?
MOVE x%,y%
CASE key% OF
WHEN 136 : REM left
x% -= size%
MOVE x%,y%
y% += size%
WHEN 137 : REM right
x% += size%
MOVE x%,y%
y% -= size%
WHEN 138 : REM down
y% -= size%
MOVE x%,y%
x% -= size%
WHEN 139 : REM up
y% += size%
MOVE x%,y%
x% += size%
ENDCASE
COLOUR 1, RND(255), RND(255), 0
GCOL 0, 1
PLOT 85, x%, y%
UNTIL FALSE
Subscribe to:
Post Comments (Atom)