Awesome!
I thought I should do a program in Basic and it should be a "ball" that bounces from side to side on the screen.
Lets start:
10 DX=1
The variable DX should store the direction of the movement
20 PO=1
30 PRINT CHR$(147)
Do a clear screen
40 FOR I=1 TO PO : PRINT " "; : NEXT
Let's loop through 1 to position. Print a space to the output and append a semicolon to tell our C64 to skip the newline, NEXT takes us on another leap in the loop
50 PRINT "O"
Write the ball to the output. With newline
60 PO=PO+DX
Add the direction variable to the position variable.
70 IF PO=39 THEN DX=-1
Check if position is 39 then change the direction variable to -1 to turn
80 IF PO=1 THEN DX=1
Check if position is 1 again. Then change the direction to 1 to turn
90 GOTO 30
The best part! Goto line 30 and start over again!
The emulator I used for this program is the CCS64: http://www.ccs64.com/
The complete program:
Have a nice day!
No comments:
Post a Comment