Path: news1.icaen!news.uiowa.edu!NewsNG.Chicago.Qual.Net!nyd.news.ans.net!newsfeeds.ans.net!newspump.monmouth.com!newspeer.monmouth.com!nntp.msen.com!usenet.INS.CWRU.Edu!cleveland.Freenet.Edu!fl332
From: fl332@cleveland.Freenet.Edu (John L. Graham)
Newsgroups: comp.sys.apple2
Subject: GSoft BASIC ditty - Wiggle
Date: 20 Aug 1998 21:01:24 GMT
Organization: Case Western Reserve University, Cleveland, OH (USA)
Lines: 49
Message-ID: <6ri2r4$j9d$1@pale-rider.INS.CWRU.Edu>
Reply-To: fl332@cleveland.Freenet.Edu (John L. Graham)
NNTP-Posting-Host: owl.ins.cwru.edu
Xref: news1.icaen comp.sys.apple2:138351
I'm having a lot of fun exploring Gsoft BASIC. It's a great language for
recreational programming. One example I hacked out over lunch today is given
below. This little program, called Wiggle, draws a dots that wiggles its way
around the screen leaving a trial of different colors behind it.
Have fun!
John
-----------------------------------snip-----------------------------------------
X0% = 160
Y0% = 100
X1% = 160
Y1% = 100
HGR
KEY% = 0
COUNTER% = 0
COLOR0% = 1
COLOR1% = 2
DO UNTIL (KEY% = 83 OR KEY% = 115)
WHILE (COUNTER% < 1000 AND KEY% <> 83 AND KEY% <> 115)
DX% = SGN ( RND (1) - 0.5) * 1
DY% = SGN ( RND (1) - 0.5) * 1
X1% = X0% + DX%
Y1% = Y0% + DY%
IF X1% > 320 THEN X1% = 320
IF X1% < 0 THEN X1% = 0
IF Y1% > 200 THEN Y1% = 200
IF Y1% < 0 THEN Y1% = 0
HCOLOR= COLOR0%
HPLOT X0%, Y0%
HCOLOR= COLOR1%
HPLOT X1%, Y1%
X0% = X1%
Y0% = Y1%
COUNTER% = COUNTER% + 1
KEY% = PEEK ($00C000)
WEND
COUNTER% = 0
COLOR0% = COLOR0% + 1
IF COLOR0% = 16 THEN COLOR0% = 1
COLOR1% = COLOR1% + 1
IF COLOR1% = 16 THEN COLOR1% = 1
LOOP