Difference between revisions of "Love - Drawing shapes"
(Created page with "=Requirements= You need to have followed the installation process for the Love engine. You also need to have created a minimal game (ie a new folder, with a 'main.lua' file)...") |
(No difference)
|
Revision as of 12:33, 4 June 2019
Requirements
You need to have followed the installation process for the Love engine.
You also need to have created a minimal game (ie a new folder, with a 'main.lua' file)
You need to have added this code to 'main.lua':
function love.load()
end
function love.update(dt)
end
function love.draw()
end
Drawing shapes
Now in the draw method add the following to draw a rectangle (or square):
love.graphics.rectangle('fill',0,0,100,50) -- 0,0 is the X & Y 100,50 is the Width & Height
love.graphics.rectangle('line', 150,0,200,200) -- 'fill' will fill the shape 'line' just give the outline
Now add the following to draw an circle:
love.graphics.circle('fill',0,250,100,100) -- 0,250 is the X & Y of the center point of the circle 100,100 is the Width & Height
love.graphics.circle('line', 150,250,200,200) -- 'fill' will fill the shape 'line' just give the outline