Page 1 of 1

New Programmer needs help w/ moving graphics by player

Posted: Sun Oct 15, 2006 7:09 am
by jetq111
hey
I need help. I need to know how you can make a DATA statement move around the screen when the player presses a button (IE wasd)

Also I need help stopping the players character from crashing into walls, (and making the walls dissaper)

If you can answer this it will be a great help

thnxs
jetq111

Posted: Sun Oct 15, 2006 7:46 am
by bungytheworm

Code: Select all

' Nixon posted this over a year ago.
DIM map(100, 100)
FOR y = 1 TO 5
FOR x = 1 TO 5
READ map(x, y)
LOCATE y, x
IF map(x, y) = 1 THEN PRINT CHR$(219)
NEXT: NEXT
px = 2
py = 2

top:
LOCATE py, px: PRINT CHR$(2)
DO: P$ = INKEY$: LOOP UNTIL P$ <> ""
LOCATE py, px: PRINT " "
IF P$ = "8" AND map(px, py - 1) = 0 THEN py = py - 1
IF P$ = "5" AND map(px, py + 1) = 0 THEN py = py + 1
IF P$ = "4" AND map(px - 1, py) = 0 THEN px = px - 1
IF P$ = "6" AND map(px + 1, py) = 0 THEN px = px + 1
GOTO top

DATA 1,1,1,1,1
DATA 1,0,0,0,1
DATA 1,0,1,0,1
DATA 1,0,0,0,1
DATA 1,1,1,1,1 
Ok. There is at least 50 tutorials for things you asked.

Posted: Sun Oct 15, 2006 4:18 pm
by {Nathan}
Darkdread wrote great tutorials on this very subject. They are basically the staple of this type of thing. Also, tilex is a pretty OK tutorial for beginners. Both can be found in the tutorials section.