-
1
- #1
I've figured out a cool way to do collision detection with the scenery. first you need to set up a screen mode with at least 2 pages. i used SCREEN 9,,0,1 (thanks to qbasicking for pointing screen mode 9 out to me). anyways, you need to make an outline of the level you have and makesure it is all one color. i used white. so you hve an outline for the level, say it looks like this
|
|
____________________|
now GET this outline using the GET command. now, you need to know how big your character is and what his coordinates are. pretend his coordinates are (x,y) and he is 2 pixels long and 2 pixels wide. now say the character is walking from the left to right. all you have to do to check the collision is
PUT (1,1),level.array%(0), xor
PUT (x,y), character.array%(0), xor
if point(x+3,y)=15 then
PUT (x,y), character.array%(0), xor
x=x-1
PUT (x,y), character.array%(0), xor
end if
PUT (1,1),level.array%(0)
PCOPY 0,1
i hope that wasn't too confusing. if it was tell me and i'll try and clear it up
|
|
____________________|
now GET this outline using the GET command. now, you need to know how big your character is and what his coordinates are. pretend his coordinates are (x,y) and he is 2 pixels long and 2 pixels wide. now say the character is walking from the left to right. all you have to do to check the collision is
PUT (1,1),level.array%(0), xor
PUT (x,y), character.array%(0), xor
if point(x+3,y)=15 then
PUT (x,y), character.array%(0), xor
x=x-1
PUT (x,y), character.array%(0), xor
end if
PUT (1,1),level.array%(0)
PCOPY 0,1
i hope that wasn't too confusing. if it was tell me and i'll try and clear it up