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! / Why does my sprite not land at the same position all of the time???

Author
Message
TLOZ
21
Years of Service
User Offline
Joined: 7th May 2005
Location: Enfield, NC
Posted: 22nd Nov 2005 05:26
I've been working on a tile based platformer and while I've finally got the tiles working, I went in to work on the sprite jumping and landing on the tiles. The problem is that when the sprite lands, the oldy position causes it to float in the air at different positions everytime. Can someone please show me how to make it land on top of the tiles everytime instead of either inside it or above it?

I'm using DBpro and I included my code and one of the bitmaps. You'll have to download the other on this next post!
TLOZ
21
Years of Service
User Offline
Joined: 7th May 2005
Location: Enfield, NC
Posted: 22nd Nov 2005 05:27
Here is the other bitmap image.
mr joe
21
Years of Service
User Offline
Joined: 12th Aug 2004
Location: Edinburger, Scotland. DBC
Posted: 24th Nov 2005 11:25
I don't have pro, so I can't amend your code, but I think I can see what is wrong.

When your player collides with a tile you set him back to his previous position. But that position is different each time you jump because you can jump different heights. You need to set it to put him back to a position at the edge of the tile. That way he will always 'land' on the ground.

Hope that helps.
TLOZ
21
Years of Service
User Offline
Joined: 7th May 2005
Location: Enfield, NC
Posted: 26th Nov 2005 06:51
Ok thanks, I'll try that.

Login to post a reply

Server time is: 2026-07-07 04:09:28
Your offset time is: 2026-07-07 04:09:28