HomeRobber
Posted: Tue Apr 28, 2009 9:11 am
I am creating game engine. And I'm kinda stuck.
How to make character move on DATA based map.
ps
im sorry for noob questions, but im noob in programing
How to make character move on DATA based map.
Code: Select all
DIM wall(10, 10), floor(10, 10)
DIM map(20, 19)
screen 13
for y = 1 to 10
for x = 1 to 10
read clr
pset (x, y), clr
NEXT: NEXT
GET (1, 1)-(10, 10),wall
for y = 1 to 10
for x = 1 to 10
read clr
pset (x, y), clr
NEXT: NEXT
GET (1, 1)-(10, 10),floor
CLS
for y = 1 to 20
for x = 1 to 20
read map(x, y)
NEXT:NEXT
FOR y = 1 TO 19
FOR x = 1 TO 20
IF map(x, y) = 1 THEN PUT (x * 10 - 10, y * 10 - 10), wall
IF map(x, y) = 2 THEN PUT (x * 10 - 10, y * 10 - 10), floor
NEXT
NEXT
'wall
0,8,8,8,8,8,8,8,8,0
8,7,7,8,7,7,7,7,7,8
8,8,8,8,8,8,8,8,8,8
8,7,7,7,7,7,8,7,7,8
8,8,8,8,8,8,8,8,8,8
8,7,7,8,7,7,7,7,7,8
8,8,8,8,8,8,8,8,8,8
8,7,7,8,7,7,8,7,7,8
8,7,7,8,7,7,8,7,7,8
0,8,8,8,8,8,8,8,8,0
'floor
6,6,6,6,6,6,6,6,6,6
0,0,0,0,0,0,0,0,0,0
6,6,6,6,6,6,6,6,6,6
0,0,0,0,0,0,0,0,0,0
6,6,6,6,6,6,6,6,6,6
0,0,0,0,0,0,0,0,0,0
6,6,6,6,6,6,6,6,6,6
0,0,0,0,0,0,0,0,0,0
6,6,6,6,6,6,6,6,6,6
0,0,0,0,0,0,0,0,0,0
'map
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,1
1,2,2,2,2,1,2,1,2,2,1,2,2,2,2,2,2,2,2,1
1,2,2,2,1,2,2,1,2,2,1,2,2,2,2,2,2,2,2,1
1,2,2,1,2,2,1,1,2,2,1,2,2,2,2,2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