Collision code
Author |
Message |
Armir
|
Posted: Tue Apr 19, 2005 7:20 pm Post subject: Collision code |
|
|
Hey, i have an assignment where I have to create a PACMAN game and I've done everything except making the pacman stop at certain points. I was just wondering if anyone could help me out. Thnx |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Vertico
|
Posted: Tue Apr 19, 2005 7:36 pm Post subject: (No subject) |
|
|
i can help. considering im also making a pacman game.
to stop him at certain places you can use an x- y- cordinates to see were its suppost to stop. for example...
code: |
if x = (somewhere between 0 to maxx) then
x -=1
end if
|
or you can use something called whatdotcolor to determine if the cordinates hit a color or not hit a color when moving. so if the walls are bue and u want it 2 stop when u reach it then u do something like....
code: |
if whatdotcolor (x , y) = blue then
(whatever you want it to do.)
end if
|
i used whatdotcolor in my game. some ppl say its not good, but its alot easyer then finding the exact cordinates of every wall.
you can look up both ways of "stopping at certain points" in the tutorials if this didnt make much sence |
|
|
|
|
|
jamonathin
|
Posted: Tue Apr 19, 2005 10:12 pm Post subject: (No subject) |
|
|
just to add to what the samurai cat guy said. if you're going to use coordinates, make sure you take in mind that he's going to be moving there, so when ur checking use:
Left or right (x - dif) or (x + dif)
Up and Down (y + dif) or (y - dif)
and just add in >0 or <maxx or <maxy
if you're using whatdotcolor, same thing.
for example moving pacman left
code: |
if whatdotcolor (x - dif, y) = good_color then
x-=dif
end if
|
|
|
|
|
|
|
c0bra54
|
Posted: Wed Apr 20, 2005 12:24 am Post subject: (No subject) |
|
|
there should be a colision system for whatdotcolour up, i helped out the person with it.. i am the random guy doing colision for a 64 map game ... lol |
|
|
|
|
|
|
|