Player colliding with tiles on map?

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
somebodyelse
Prole
Posts: 11
Joined: Thu Feb 13, 2014 4:49 am

Player colliding with tiles on map?

Post 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.
Attachments
Tile map.love
(2.29 KiB) Downloaded 69 times
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Player colliding with tiles on map?

Post 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.
somebodyelse
Prole
Posts: 11
Joined: Thu Feb 13, 2014 4:49 am

Re: Player colliding with tiles on map?

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

Who is online

Users browsing this forum: No registered users and 7 guests