07-17-2003, 03:08 PM
Rules: everyone can add 20 lines to this code, comments SUB/Funcs start-stop doesn't count. Here's a start:
Some one else must have made an addition before you can make a nother one.
Let's see what we end up with.
/Zap
Some one else must have made an addition before you can make a nother one.
Code:
DECLARE SUB drawSprite (spr AS INTEGER, x AS INTEGER, y AS INTEGER) '1
SCREEN 7 '2
'************************
'Variables/Constants:
'------------------------
CONST numOfSprites = 1 '3
DIM SHARED sprites(numOfSprites - 1, 7, 7) AS INTEGER '4
CONST sprCarNorth = 0 '5
'************************
'Read graphics:
'------------------------
FOR spr = 1 TO numOfSprites '6
FOR y = 0 TO 7 '7
FOR x = 0 TO 7 '8
READ sprites(spr - 1, x, y) '9
NEXT x, y, spr '10
'************************
'Main loop here:
'------------------------
DO '11
k$ = INKEY$ '12
WAIT &H3DA, 8 '13
drawSprite sprCarNorth, 150, 100 '14
LOOP UNTIL k$ = CHR$(27) '15
'************************
'Graphics:
'------------------------
'*** Car:
' 16:
DATA -1,4,4,4,4,4,4,-1,-1,-1,8,4,4,8,-1,-1,-1,-1,8,4,4,8,-1,-1,-1,-1,4,4,4,4,-1,-1,-1,-1,4,7,7,4,-1,-1,-1,8,8,4,4,8,8,-1,-1,8,8,12,12,8,8,-1,-1,-1,12,12,12,12,-1,-1
SUB drawSprite (spr AS INTEGER, x AS INTEGER, y AS INTEGER)
FOR i = 0 TO 7 '17
FOR j = 0 TO 7 '18
IF sprites(spr, i, j) <> -1 THEN PSET (i + x, j + y), sprites(spr, i, j)'19
NEXT j, i '20
END SUB
Let's see what we end up with.
/Zap