Page 1 of 1

Player colliding with tiles on map?

Posted: Thu Feb 27, 2014 8:37 am
by somebodyelse
I am following one of the tile map scrolling tutorials and I've got it working but how do I make objects collide with the tiles? How can I choose which tiles can and cannot be collided with? For example, if I want the player to bounce off of tile[3] but to speed up when colliding with tile[2] and to just walk while colliding with tile[1], how would I do that? (or any/either one of those)?

I know how to Draw a ball, give it restitution and make it bounce using love.physics. But it doesn't "just work" with the tiles, so how would I do that?

I've tried learning from the code from external platformer tutorials online but haven't been able to incorporate it into my own game.

Re: Player colliding with tiles on map?

Posted: Thu Feb 27, 2014 9:12 am
by Azhukar
Take a look at http://love2d.org/forums/viewtopic.php?f=5&t=77091 for an example of how to work with static rectangle tiles using love.physics.

Re: Player colliding with tiles on map?

Posted: Thu Feb 27, 2014 10:00 am
by somebodyelse
Azhukar wrote:Take a look at http://love2d.org/forums/viewtopic.php?f=5&t=77091 for an example of how to work with static rectangle tiles using love.physics.
Oh dude thanks for sharing your code, it's awesome. It even answers the "how do I rotate the ball" question I wasn't going to ask :P lol. Much appreciated!