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! / Collision Help

Author
Message
MakcKid
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location:
Posted: 15th Feb 2004 06:00
I need to make my guy stop when he hits a wall which is a one tile..here's my code..



if you know how to that would be a huge help..thanks a lot

.....
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 15th Feb 2004 06:47
sprite collision is not that hard.

If this mini snippet helps, feel free to pull it apart.



MakcKid
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location:
Posted: 15th Feb 2004 17:56
thanks...but its not exactly what i was looking for..here my whole program:


if you know how to make it so the guy stops when he hits a wall that would be great. thanks!

.....
LordoFire
20
Years of Service
User Offline
Joined: 14th Feb 2004
Location: United States
Posted: 16th Feb 2004 05:06 Edited at: 16th Feb 2004 05:07
is your wall a sprite? If not then sprite collision wont work on it(unless you put an invisible sprite on it and set the collision)

When it comes to programing, I'm on fire!
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Feb 2004 12:37
He's using array collision.

you could change this......if movedx>=oldmovedx+50

for this...


if movedx >= 50 then movedx = movedx - 50
posy = posy + 1

MakcKid
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location:
Posted: 16th Feb 2004 15:02
if map(posx,posy)=1 then blocked = 1

All I'm looking for is how to make my guy stop when blocked=1
I know how to check if he is at a 1 tile on my map, I just don't know how to stop him. If you know how that would be a great help.
Thanks a lot!

.....
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Feb 2004 15:25 Edited at: 16th Feb 2004 15:26
Put the man to his last position.

if blocked = 1
guyx = Oldguyx
guyy = OldGuyy
movedx=oldmovedx
movedy=oldmovedy
posx=Oldposx
posy=Oldposy
blocked = 0

endif

That should fix it, although you need to keep the OldGuyy updated in the loop.

Pincho.

MakcKid
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location:
Posted: 16th Feb 2004 20:06
thanks, that works. I have a problem though. I purposly took out all of the walls from my data, but it thinks that there are walls at
1,3 2,3 3,3 3,2 3,1...there aren't. Here's my code:

Whats's wrong. Thanks again.

.....

Login to post a reply

Server time is: 2024-05-13 13:36:14
Your offset time is: 2024-05-13 13:36:14