Qbasicnews.com

Full Version: Programming a game together-challenge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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.

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
Can I delete someone else's lines?
Yeah, 'cause the sprite blitter is too slow.
Nath, my question was just theoretical, but you killed this thread... Big Grin
Hey, I didn't intend such a thing!
Could be, but you've done it anyways... Cry ... Big Grin

Yup, you can delete others lines. And, I know the sprite blitter's too slow, but I didn't thought it mattered too much, as some one else could change it.

/Zap
C'mon guys, can't be that boring!
you'd never get anything done, because people would be deleting everyone elses lines. and there's too much chaos. no paramaters.
Yeah, I think this challenge is a great idea, but lets set some objectives for it. Pacman clone or racing game? Let's hear some ideas.
racing game..2d........
Pages: 1 2