Page 1 of 1

STI and collision - collision map seems offset

Posted: Tue Feb 11, 2020 10:32 pm
by TalliDown
Hi,

I am trying to get collision working on a tile map using STI and bump. My "player" is colliding in some places, however the shape of the collidable section is all wrong. It is as if the collidable tiles are somehow in the wrong spot / larger than it should be. Anybody who could point me in the right direction for this issue.

If interested I have uploaded my (very short) code to github for you tocheck and run for yourselves: https://github.com/ErwinM/sti-collision

Any help is much appreciated,
Erwin

Re: STI and collision - collision map seems offset

Posted: Thu Feb 13, 2020 12:10 pm
by pgimeno
Hi TalliDown, welcome to the forums!

You're moving both your player and the map. You should draw your player at the centre of the screen. It doesn't make sense for the player to travel out of the screen as is possible now.

On the other hand, you're forgetting to apply the scale to the width and height of your player when drawing.