Game Development Reference
In-Depth Information
Displaying images with LÖVE
In the following code, we can load an image (a texture as it would be called) and we can use this
texture and display it several times without having to load it again.
img = love.graphics.newImage("myImage.png")
wd, ht = img:getWidth(), img:getHeight()
function love.draw()
love.graphics.draw(img, 10, 10)
love.graphics.draw(img, 10+wd, 10)
love.graphics.draw(img, 10, 10+ht)
love.graphics.draw(img, 10+wd, 10+ht)
end
You could use this, for example, for tile-based games, where you need to tile or repeat an image.
Search WWH ::




Custom Search