Hi this is my first post,
I'm having trouble with a platform game I've started,
Basically, I'm checking my players x and y positions against the tile one tile down in the tilemap, it works, he stands on any tile that is greater than 0, but as you can see from my pictures he is never actually directly aligned to the top of the tile, sometimes he is trouser deep sometimes even neck deep.
I'm not sure how to correct this, I've seen an example in another basic of using mod to position the player correctly. but I didn't really understand it
(http://picpaste.com/pics/prob1.1266938309.png)
http://picpaste.com/prob1.png (http://picpaste.com/prob1.png)
(http://picpaste.com/pics/prob2.1266938325.png)
http://picpaste.com/prob2.png (http://picpaste.com/prob2.png)
LOCAL x1,y1
x1 = (playerX-offsetX)/tilesize //Player X pos - screen offset (for scrolling screen) / size of tiles (32)
y1 = (playerY-offsetY)/tilesize+1
IF tilemap[x1][y1] > 0 //a 0 in the tile map means their isn't a tile
falling = 0 //player isn't falling
ELSE
falling = 1
playerY = playerY + gravity +playerYspd //move player downwads.
ENDIF
Why not just make him have the same Y coord as the tile he is standing on, minus his height of course? As long as he not jumping or falling.
Thanks it works, :S :S
In the words of Homer 'Do'h'
I can't believe it's so obvious, what a great first post by me!
No problem :good: