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.

Newcomers DBPro Corner / Help with sprite collision problem (DBC)

Author
Message
Saiochi
18
Years of Service
User Offline
Joined: 17th Sep 2006
Location: Under your bed
Posted: 25th Sep 2006 04:06
Been trying to figure out how to make my character collide with a sprite, got it to work with one problem.. When you collide with another sprite you will go in 6 pixels, then when you let go of whatever key you\'re holding you snap back to the edge..



I know this problem has something to do with this walking system, since whenever you press a key you automatically go in the direction 6 pixels. I was wondering how I could re-do this walking system to work better with sprite collisions.

If you have X-ray vision, can you see through your own eyelids?
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 25th Sep 2006 05:02
You should first save the current position of the sprite. Then repositin the sprite, check collision. If a collision is detected, then reposition the sprite in it's older position.

Now thats the basic way of doing it. There are better ways of doing it, and that improve the way the sprite might collision.

I think that your problem is that first you check collision, and then you move, or at least not repositioning the character after a collision was detected.

Further on my stuff at...
Saiochi
18
Years of Service
User Offline
Joined: 17th Sep 2006
Location: Under your bed
Posted: 25th Sep 2006 08:58 Edited at: 25th Sep 2006 09:06
I think the problem is that there is no collision detecting in the do/loop loops for the keys, so if I press the key DBC doesn't know i'm colliding with another sprite until I let go of said key.. So would I have to re-program my arrow keys or is there some kind of way around it, 'cause I can't seem to find one to save my life =X

EDIT : Here's what i'm talking about


http://img91.imageshack.us/img91/4331/spritect1.png

If you have X-ray vision, can you see through your own eyelids?

Login to post a reply

Server time is: 2024-09-25 09:32:47
Your offset time is: 2024-09-25 09:32:47