We be cool people making videogamez!
- Löve2D - game engine - https://love2d.org/
- Git - version control - https://git-scm.com/ +> Your favorite git tool
- Google Drive - assets sharing - https://www.google.com/drive/download/
- Text editor / IDE for LUA, we recommendations: +> Sublime Text - text editor - https://www.sublimetext.com/ ++> With plugin: BracketHighlighter +> Atom - text editor - https://atom.io/
- Any program of your preference capable of producing pixel art +> I will personally use Adobe Photoshop and Aseprite (https://www.aseprite.org/) +> It should be able to handle animations
- I don't know this part, Peter usually handles this
- Tiled - http://www.mapeditor.org/
The structure used for the game is called ECS (Entity Component System). It's based on three (five) main components:
- Entities: Things that exist within the game. For instance, the player. They are basically just a reference.
- Components: Properties of Entities. Example: Position.
- Systems: Logical systems, such as Gravity, or Drawing
Creating them
Create a function that makes them and fills them. Put this function in the entities folder. It will get loaded automatically. Example:
local id = 0
return function(x,y, rot)
local agent = {}
id = id + 1
agent.name ="agent".. id
agent.position = {x=x, y=y, rotation=rot}
agent.basic_move = {true}
agent.speed = {speed = 100}
agent.bump_shape = {w = 28, h = 28}
return agent
end
Adding an entity:
local pl = core.entity.add(game.entity_definitions.player.player(400,1100, 20))
Removing an entity: core.component.remove(v, "idle")
Components are mostly added inline for Entities, since a lot of components are trivial, data-wise.
A system is a logical unit. It contains:
- A name (String). It has to be unique.
- A function. Often update or draw.
- A dictionary of requirements. Those are the names of components that entities must all have in order to be in the target list of a system.
A system automatically gets a list of targets. That one can be iterated over (using pairs) to get all targets of a system.
We use a standard gamestate switching library. This takes over the standard love2d draw and update functions. Example:
function ctx:enter(dt)
GS.push(core.states.loading)
love.mouse.setGrabbed(true)
end
function ctx:update(dt)
for k,v in core.system.orderedPairs(game.system_categories.update) do
v.update(dt)
end
end
function ctx:draw()
love.graphics.push()
for k,v in core.system.orderedPairs(game.system_categories.draw) do
v.draw()
end
love.graphics.pop()
for k,v in core.system.orderedPairs(game.system_categories.draw_ui) do
v.draw_ui()
end
love.graphics.print("Current FPS: "..tostring(fps).. "MIN".. minfps, 10, 10)
end
function ctx:leave()
love.mouse.setGrabbed(false)
print('leaving')
end