Game Development Reference
In-Depth Information
Coloring an image black to create a mask or silhouette
You could use this technique in games for children—for example, to have children guess what an
object is from its black silhouette.
Moving Around
You learned about the
love.update
function previously, which is the equivalent of
enterFrame
in other
frameworks. In this exercise, we'll use this to move
myImage2.png
around the screen.
local _W, _H = love.graphics.getWidth(), love.graphics.getHeight()
local dirX, dirY = 10, 10
local theImage, x, y
function love.load()
theImage = love.graphics.newImage("myImage2.png")
x = 50
y = 50
love.graphics.setColor(0,0,0,255)
love.graphics.setBackgroundColor(255,255,255,255)
end
function love.draw()
love.graphics.draw(theImage, x, y)
end