I am trying to make a game where the player walks through rooms.
I can't figure out how to prevent the player from walking through the walls.
Move with WASD
if the screen is black when ran, press WASD
***Here is the code***
'COLOR VARIBLES AND STUFF
MAPX = 15
MAPY = 15
PC = 7
SC = 8
FC = 6
CC = 4
x = 3
y = 3
'This makes the map
jail:
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DATA 1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,2 DATA 1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1 DATA 1,0,0,0,1,0,0,0,1,1,1,1,1,0,1,1 DATA 1,3,0,3,1,3,3,3,1,0,0,0,0,0,0,1 DATA 1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1 DATA 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1 DATA 1,1,1,1,1,1,2,1,1,1,1,1,0,1,1,1 DATA 1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1 DATA 1,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1 DATA 1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1 DATA 1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1 DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
'KEYPRESSES
y = y - 1: u = 1
y = y + 1
y = y + 1: d = 1
y = y - 1
d = 0
IF K$
= "a" THEN x
= x
- 1: l
= 1 IF K$
= "d" THEN x
= x
+ 1: r
= 1 'RENDER/UPDATE ROOM WHEN MOVEMENT IS DETECTED
num = room
u = 0
'DRAW PLAYER