Play With Lua!

Archive for August, 2012

Pushing crates

without comments

Player movement is really hard to get right. It seems like it wouldn’t be, like it’s just as simple as “if the left arrow key is down, move to the left”, but it’s actually surprisingly difficult. Feel is really important. Try playing Mario 2: each character plays the same levels with the same enemies and the same rules, but because they have their movement tweaked differently they play totally differently. Luigi can jump the farthest but has a lot of inertia for changing direction mid-jump, for example. It’s something you can tweak indefinitely.

In this post, and probably the next one, I’m going to walk through one way to do it for a top-down (Zelda-like) game in Löve, that feels “right” to me. This isn’t going to touch on code organization at all, or how to start using Löve (there are other posts about that already), it’s just going to be an explanation of what I have figured out over the past couple weeks of poking at this. So, let’s start with some basics:

Read the rest of this entry »

Written by randrews

August 7th, 2012 at 11:21 pm

Posted in Uncategorized

Points

without comments

I’ve been doing a lot of writing games in Löve. Writing games usually involves a lot of code that deals with positions and directions and velocities. To make this easier to write, I made a little library to represent a point in a two-dimensional coordinate space.

This is a little different for posts here because I’m not going to go into the code too much; I’m just going to show some examples of how to use it. Really, the motivation here is that I want to make other posts with code examples that use this, and so I should document it. Next up, my “map” class.

If you just want the code, the canonical repository is here.

Read the rest of this entry »

Written by randrews

August 3rd, 2012 at 11:59 am

Posted in Uncategorized