Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / How to do 2d collision

Author
Message
Danno
20
Years of Service
User Offline
Joined: 19th Feb 2004
Location: england
Posted: 20th Feb 2004 19:04
I'm making a 2d pacman type of game. I have a large circle as 'pacman' and smaller ones for the enemies. I have all the controls for these its just that i need to know how to make 2d collision so that when the 'pacman' runs into the circles they dis-appear.
please help.
Here is what i have so far
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Feb 2004 19:39
Your program is not using the traditional Pacman method, it makes things easier. You can use the distance formula for your collision.

Use your x,y Pacman pos for x1,y1, and your dot positions for x2,y2


function distance(x1,x2,y1,y2)
endfunction sqrt(((x2-x1)^2)+((y2-y1)^2))

comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 20th Feb 2004 20:52 Edited at: 20th Feb 2004 20:56
I used sprite for my pac-man and pills

I did this

for dispills=# to #
if sprite collision (pacmannumber,dispills)>0 then hide dispills
next dispills

change the hashes by the start number pills sprite to the final pill

CURRENT PROJECT: RETRO PAC-MAN

Login to post a reply

Server time is: 2024-05-17 06:54:46
Your offset time is: 2024-05-17 06:54:46