Drawing Shapes and Images
Put graphics on screen.
The love.graphics Module
All rendering in LÖVE happens through love.graphics. You call its functions inside love.draw, and the engine presents the frame when the callback returns.
It can draw primitive shapes, images, text, and lines, plus manage colors and transforms. Everything is redrawn from scratch every frame.
Drawing Rectangles
love.graphics.rectangle takes a mode then position and size. The mode is either 'fill' for a solid shape or 'line' for just the outline.
Coordinates start at the top-left corner of the window, with x increasing to the right and y increasing downward.
function love.draw()
love.graphics.rectangle('fill', 50, 50, 120, 80)
love.graphics.rectangle('line', 200, 50, 120, 80)
endAll lessons in this course
- The LOVE Game Loop
- Drawing Shapes and Images
- Handling Input
- Movement and Collisions