I decided to participate in the Ludum Dare with Löve this time. It's my first time using it, as well as the first time doing some major work in Lua, but it ended up being quite ok (even the array starting at 1 shenanigans). I did have quite a bit more trouble when porting it to HTML5 though, but in the end it was done (after like 4 extra hours but oh well).
Here are the links:
If anyone is interested in learning from its source, it's in the links above. It ended up being a massive single 1K-lines file, but the logic should be simple enough.
The main gameplay logic happens after the player inputs a key, which usually moves the little robot along the grid, checking if it can push blocks along the way. The update callbacks are used to smoothen the transitions with my special sauce; exponential ease-in transitions;
There's also a main menu screen and a game over screen. The main menu is simply a static image with black rectangles drawn on top; each rectangle is then faded into transparency to animate the thing behind it "fading in".
Code: Select all
-- x is the current drawn position -- tx is where it is supposed to be, and where it's transitioning to, its target -- lambda is a number close to zero; 0.1, 0.05, etc. -- called each frame x = x + lambda * (tx - x)
The game takes place in a space station in space; the game over screen has that station slowly going further away, it keeps the stars, and fades in a pixel-caligraphy "Game Over", as something interesting happens with the music;
Code: Select all
-- menuTimer is the time since we moved into the menu -- 10 is the time where the rectangle should start fading out. love.graphics.setColor(0, 0, 0, 1 - (menuTimer - 10) * 2) love.graphics.rectangle("fill", 0, 150, 300, 210)
The game has two music loops; the main menu one and the in-game one. They just happen to fit in perfectly; so they actually both play at all times, but
- In the main menu, the game music is set to volume 0.
- As the game starts, we cross-fade from the menu music into the game music.
- On game over, we keep the game music, but slowly fade in the menu music.
- When returning to the main menu, we suddenly drop the game music.
Anyway, if you're interested in how I did something, I'll be glad to look up the piece of code and discuss it! As a jam game, it was not commented as well as it should...