©2019 by Flower Power - 10liner, 1key game. Proudly created with Wix.com

flower power2.png

FLOWER POWER

A small one-switch "game" written in 10 lines of BASIC

 

10 LINES, 1 SWITCH, 3 SYSTEMS

Learning about the 10liners competition, I decided to write my own 10liner game. However, I added another challenge: to make a game using just one key (switch). When I was a teen, during the mid-90s I wrote several simple games aimed for people using switches or other accessibility accessories. Some of these games were inspired by the vast library of such games that were available on the BBC micro. So now, after finishing the first version of the game, I am converting it to the BBC BASIC (Update: I started with converting it first to the MSX, which is much easier)

 

THE GAME

The game is simple. You control the seed flying in the wind. Arriving at a water drop will make the seed grow into a flower (and you will get a point). The problem: each key (or switch) stroke will change the direction but not necessarily to the direction you wish. Learn sequence and master the seed's movement in order to let many flowers grow.

 

The Game code - MSX version (PUR-80)


1 SCREEN 2:COLOR 5,0,2 :CLS: px = 50: py = 50: tr = 3 
2 cx=INT(RND(1)*192):cy=INT(RND(1)*256):FOR t=1 TO 20:CIRCLE(cy,cx),t:a$=INKEY$
3 CIRCLE(py,px),3,0:CIRCLE(cy,cx),t,0:py=py+(tr-2*(tr/(ABS(tr))))*2
4 px=px+(tr /(ABS(tr)))*(2):CIRCLE(py,px),3,1:IF a$<>"" THEN tr=tr-2:a$=""
5 IF py > 256 OR px > 192 OR py < 0 OR px < 40 THEN tr = tr - 2
6 IF py < cy + 20 AND py > cy - 20 AND px<cx+20 AND px>cx-20 THEN cls:GOTO 9
7 IF tr < -3 THEN tr = 3
8  NEXT: GOTO 2
9 x = cy: y = cx:PSET (x, y):FOR c=0 TO 360 STEP 30: FOR I=1 TO 8:z=3.141/180
10 z=z*(45*(I-1)+c):x=x+20*COS(z):y=y-20*SIN(z):LINE -(x, y):NEXT:NEXT:GOTO 1

 

The Game code - MSX version

1 SCREEN 2:COLOR 5,0,2 :CLS: px = 50: py = 50: tr = 3 
2 cx = INT(RND (1) * 192): cy = INT(RND (1) * 256): FOR t = 1 TO 20: CIRCLE (cy, cx), t, 4: a$ = INKEY$
3 CIRCLE (py, px), 3, 0: CIRCLE (cy, cx), t, 0: py = py + (tr - 2 * (tr / (ABS(tr)))) * 2
4 px = px + (tr / (ABS(tr))) * (2): CIRCLE (py, px), 3, 1: IF a$ <> "" THEN tr = tr - 2: a$ = ""
5 IF py > 256 OR px > 192 OR py < 0 OR px < 40 THEN tr = tr - 2
6 IF py < cy + 20 AND py > cy - 20 AND px < cx + 20 AND px > cx - 20 THEN cls:GOTO 9
7 IF tr < -3 THEN tr = 3
8 NEXT: GOTO 2
9 x = cy: y = cx: PSET (x, y): FOR c = 0 TO 360 STEP 30: FOR I = 1 TO 8: z = 3.141 / 180 * (45 * (I - 1) + c): x = x + 20 * COS(z)10 y = y - 20 * SIN(z): LINE -(x, y): NEXT: NEXT: s = s + 1: GOTO 1

 

The Game code - QB64 version


1 SCREEN 12: CLS: px = 160: py = 160: LOCATE 1, 1: PRINT "Flower power, 2019, Score = ", s: tr = 3
2 cx = INT(RND * 480): cy = INT(RND * 640): FOR t = 1 TO 40: CIRCLE (py, px), 10, 4: CIRCLE (cy, cx), INT(t / 2), 2: a$ = INKEY$
    3 FOR n = 1 TO 5000000: NEXT: CIRCLE (py, px), 10, 0: CIRCLE (cy, cx), INT(t / 2), 0: py = py + (tr - 2 * (tr / (ABS(tr)))) * 2
    4 px = px + (tr / (ABS(tr))) * (2): CIRCLE (py, px), 10, 1: IF a$ <> "" THEN tr = tr - 2: a$ = ""
    5 IF py > 640 OR px > 480 OR py < 0 OR px < 40 THEN tr = tr - 2
    6 IF py < cy + 20 AND py > cy - 20 AND px < cx + 20 AND px > cx - 20 THEN GOTO 9
    7 IF tr < -3 THEN tr = 3
8 NEXT: GOTO 2
9 x = cy: y = cx: PSET (x, y): FOR c = 0 TO 360 STEP 30: FOR I = 1 TO 8: z = 3.141 / 180 * (45 * (I - 1) + c): x = x + 40 * COS(z)
10 y = y - 40 * SIN(z): LINE -(x, y): NEXT: NEXT: a$ = INKEY$: IF a$ <> "" THEN s = s + 1: GOTO 1 ELSE GOTO 9

 

MSX SCREENSHOTS

 
 
This site was designed with the
.com
website builder. Create your website today.
Start Now