Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

klubbkid

Pixel movement engines...

This topic is 6338 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m trying to write a pixel based movement engine. 16x16 tiles, 16x16 players...now the problem I''m having is not with the actual movement, but with finding out what tile the player is on. I''m going: mapX = (int)(playerPixelX / 16); mapY = (int)(playerPixelY / 16); but for some reason this allows players to wiggle onto a collision tile even though they should be able to... blah blah I''m probably rambling on..so if anyone has any ideas, or tutorials on this sorta thing lemme know please - Derek http://gbc.n3.net/

Share this post


Link to post
Share on other sites
Advertisement
Ill just point out some things that come to mind and you can go from here.
First of all, are mapx, mapy, playerpixelx, playerpixely all declared as INT to begin with? If so, i dont see the reason to "cast" the equations you have TO int since any equations involving just ints are truncated anyways...basically its redundant.

Secondly, i dont understand exactly what you mean by this:
quote:

but for some reason this allows players to wiggle onto a collision tile even though they should be able to...


I dont know what you mean by wiggle and dont you mean the player "shouldN'T be able to.." ?
Well, ill assume its a type-o and you meant shouldnt NOT should. But you need to explain a little more what is going on. You say your movement is ok, but it sounds like you can move onto tiles which your not suppose to...if this is the correct assumption then i see some areas you should clarify:
1) what are you using to check the boundries of the player and tiles with: the pixelpointx,y of the player or a bounding box of the player?? this will definately affect what your player can move across on the map.
2) IF your only using the players pixelx,y position to check if map can move on a tile...where are you "defining" this point to be related to where the player image is drawn. You may be using the x,y pixel position as the point where you DRAW the bitmap.. but this is not the actual position of the player... its only the position to blit the image..not the actual position.

As you can see, you were in fact not descriptive enough to really get to the problem....but hope that gets you to think about what may be wrong.

aka John M.
Never give up. Never surrender!




Edited by - GalaxyQuest on January 14, 2001 4:39:57 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!