Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Collision code
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Armir




PostPosted: 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 Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Vertico




PostPosted: 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




PostPosted: 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




PostPosted: 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 Razz... lol
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: