Start Gamedev Introduction to LÖVE
©2015-2017 Fabian Gerhard, Iwan Gabovitch (qubodup.itch.io/startgamedev)
Licensed under a Attribution-ShareAlike 4.0 International License
1 Prepare
1. Extract StartGamedev and open the text editor using the open-editor file.
2. Read the tasks, type the code (source code) and test the results.
3. Inside one task (e.g. 1.1), continuously expand the code. When you begin a new task (e.g.
1.2), clear the code in your text editor first.
4. Functions (e.g. function love.draw() ... end) should only appear once.
5. Use the Tab key to indent (left of Q). Keep your code readable.
6. Functions, loops and conditions end with end. The lines above end are the body.
7. Your line numbers can differ from the numbers in the tasks.
2 Better than paper: draw in LÖVE
2.1 Your favourite rectangle
A rectangle at position x=100, y=200. 300 pixels in width and 150 in height.
1 function love.draw()
2 love.graphics.rectangle("fill",100,200,300,150)
3 end
1. Move the rectangle.
2. The screen is of size 800,600. Align the rectangle with the upper right corner.
3. Replace ”fill” with ”line”, what happens?
4. Draw a second rectangle somewhere else. Copy only line 2.
5. Make the screen white.
2.2 Two rectangles
1 function love.draw()
2 love.graphics.setColor(0,255,0)
3 love.graphics.rectangle("fill",100,200,300,150)
4 love.graphics.setColor(255,255,255)
5 love.graphics.rectangle("fill",300,400,100,50)
6 end
1. Change numbers in line 2. What happens?
2. This representation of colors using three numbers (0-255) is called RGB (Red-Green-Blue).
Make the smaller rectangle blue.
3. Move the rectangles so that they overlap. Which rectangle is in front?
4. Swap lines 3 and 5. What changed?
Introduction to LÖVE - 17.01.05 1/4 qubodup.itch.io/startgamedev