Friday, March 22, 2019

Love2D Platformer Demo

Requirement
Love2d version 0.9.1
https://bitbucket.org/rude/love/downloads/
https://love2d.org/wiki/Getting_Started


Source Link
Platformer Download Link. Click to download


Bugs
There are bugs all over... brace yourself... you are forewarned!


Credits
All credits are in the credits.txt file


Stuff to do
Walk around, Jump, run, climb pole, move box and port
To move to the next level, touch image below on either side of the game

Since this is a demo, i placed one at the beginning to quickly switch to the next level
Climb this

Move the box

Bounce on the tramp



Controls
Move Left - left arrow key
Move Right - right arrow key
Run - left shift + arrow key
Jump - up arrow key
Action (climb/move object) - 'e' key
Portal - 'z' key
Quit - 'escape' key

To climb or move an object
- press and hold 'e' key + arrow key

Trampoline / Bounce
- press down arrow key when standing on the the trampoline

To port the player
-the 'z' key must be pressed twice and two boxes colored orange and green will be created
Press 'z' key once and wait till the port box stops moving and press 'z' key again
Jump onto the green box to port to the orange box


Tutorial
This demo is based on Love2d Platformer Tutorial by OSMstudios
To understand how this works, check out the tutorial at http://www.osmstudios.com/tutorials/love2d-platformer-tutorial-part-1-the-basics


Menu/Game Settings
Settings are stored in a settings.txt file
Use the guide here (https://love2d.org/wiki/love.filesystem) to find its location on your system


Main file(main.lua)
Loads your settings - love.filesystem.load or the default setting is used
The game changes state(menu, levels...) with Gamestate.switch, a gamestate system (libs.hump.gamestate)
The music is set with love.audio
The game quits with love.event.push("quit")


Configuration file(conf.lua)
https://love2d.org/wiki/Config_Files


Assets Folder
All images and sound are here
The levels folder contains all levels. check out https://www.mapeditor.org/


Entities Folder
It has all the active objects in the game(player, enemy, ...)

(entity.lua and entities.lua)
The functions in the entity and entities files are responsible for adding the object to the game using
a class system(libs.hump.class). All other objects inherit from them

(player.lua)
Movement of the player - love.keyboard.isDown
https://love2d.org/wiki/love.keyboard
Collision and response - self.world:move
https://github.com/kikito/bump.lua
Creating an object - player:fire
Check out kikito's demo http://github.com/kikito/bump.lua/tree/demo

(enemy.lua)
Animation - https://love2d.org/wiki/Tutorial:Animation


Gamestates Folder
It contains the level constructors, transition and menus of the game


libs Folder
It contains all the libraries used in the game
BUMP (collision detection) - https://github.com/kikito/bump.lua
HUMP (gamestate and class) - https://github.com/vrld/hump
SER (serialization) - https://github.com/bakpakin/binser
STI (simple tile implementation) - https://github.com/karai17/Simple-Tiled-Implementation
Camera control - http://ebens.me/post/cameras-in-love2d-part-1-the-basics/