Tile-Based Physics

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Tile-Based Physics

Post by LuaWeaver »

Slightly odd physics, not entirely accurate. The world is tile based, while entities are pixel-coord based (which is odd). Anyways, you have a little blue rectangle (entity class) on a white rectangle (several instances of the tile class), both stored in an instance of the world class. Odds are, it's buggy. If you find any, please, let me know.

Any tips on how to make this better are welcome; this is the first time I've actually done something with physics.

Controls:
L/R Arrow keys: Move.
Up arrow key: Jump.
Spacebar: Respawn your guy.

EDIT: Known bugs:
Can get stuck if you move off cliff then move in other direction immediately. Not sure how to fix without recoding physics (again).
Seems to "hug" wall when falling and moving towards it. Intentional.
Attachments
TilePhysics.love
V0.1
(8.16 KiB) Downloaded 258 times
"your actions cause me to infer your ego is the size of three houses" -finley
User avatar
BulbaMander
Citizen
Posts: 65
Joined: Sat Dec 15, 2012 7:00 pm

Re: Tile-Based Physics

Post by BulbaMander »

You can tap the jump button really fast and your man will fly up. Set a bool in your code, and only apply upward force to the player when the bool is true. When you press the jump button, it's set to false, and won't be true again until the player collides with a tile. That will make me unable to press the jump button a bunch of times in mid air.
It takes an idiot to do cool things. Thats why they're cool. :emo:
szensk
Party member
Posts: 155
Joined: Sat Jan 19, 2013 3:57 am

Re: Tile-Based Physics

Post by szensk »

BulbaMander wrote:You can tap the jump button really fast and your man will fly up. Set a bool in your code, and only apply upward force to the player when the bool is true. When you press the jump button, it's set to false, and won't be true again until the player collides with a tile. That will make me unable to press the jump button a bunch of times in mid air.
or make it an number and allow double jumps and/or boost gauge. :joker:
Post Reply

Who is online

Users browsing this forum: No registered users and 182 guests