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! / sprite collision problem

Author
Message
Kwiki Mart
20
Years of Service
User Offline
Joined: 9th Dec 2003
Location: PA
Posted: 5th Jan 2004 04:00
pic 1

In this game I am still having a problem with the collision. The collision works fine but if I am bumping in to the wall and then turn around I end up going backwards through the wall. My code is a simple if sprite collision(#,#)=1 and image=# then X=X-# to push it back. Any thoughts on how to shrink my code and stop me from backing through the wall?


On target, On time!
Great Knight
21
Years of Service
User Offline
Joined: 25th Feb 2003
Location:
Posted: 5th Jan 2004 07:46
simple make it if you hit the wall, make the moving boolean turn off or moving int varible become 0 for that direction, and in the loop make the int varible go back to defaults at the top. also use coordinates for your collision with walls, it will make it better for this type of game then the built in ones.
i will write a example tomorow i got no time now.

AMD Atherlon 2400+ XP, 380 DDr memeory, ATI Radeon 9000 64 DDR, Windos XP home edition.
-----------------------And a Katana.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Jan 2004 10:32
You might try bouncing it 1 pixel away from the wall. Sometimes if you leave something in a collision state the collision isn't registered the second time.

Pincho.

Login to post a reply

Server time is: 2024-05-12 04:24:49
Your offset time is: 2024-05-12 04:24:49