STI and collision - collision map seems offset

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
TalliDown
Prole
Posts: 1
Joined: Tue Feb 11, 2020 10:25 pm

STI and collision - collision map seems offset

Post 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
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: STI and collision - collision map seems offset

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot], Yahoo [Bot] and 4 guests