This is my game so far. Ignore the background. xD
I have this:
Code: Select all
bird = {}
bird.x = 0
bird.y = height/2
bird.speed = 300
Please help,
Maxim Deprez (MxMCube)
Code: Select all
bird = {}
bird.x = 0
bird.y = height/2
bird.speed = 300
Code: Select all
screen = {
width = love.graphics.getWidth(),
height = love.graphics.getHeight()
}
function love.load()
bird = {
x = 0,
y = screen.height / 2,
speed = 300,
width = 32,
direction = "right"
}
end
function love.update(dt)
if bird.direction == "right" then
bird.x = bird.x + bird.speed * dt
if (bird.x + bird.width) > screen.width then
bird.x = screen.width - bird.width
bird.direction = "left"
end
else
bird.x = bird.x - bird.speed * dt
if bird.x < 0 then
bird.x = 0
bird.direction = "right"
end
end
end
function love.draw()
love.graphics.rectangle("fill", bird.x, bird.y, bird.width, bird.height)
end
Users browsing this forum: Ahrefs [Bot] and 4 guests