Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- platform = {}
- player = {}
- movement = {}
- function love. load()
- platform.w = love.graphics.getWidth()
- platform.h = love.graphics.getHeight()
- movement.x = 1;
- movement.y = 1;
- platform.x = 0
- platform.y = platform.h / 2
- player.x = platform.w / 2.4
- player.y = platform.h / 2.4
- player.speed = 200
- end
- function love.update(dt)
- if love.keyboard.isDown('d') then
- player.x = player.x + (movement.x * dt)
- elseif love.keyboard.isDown('a') then
- player.x = player.x - (movement.x * dt)
- end
- end
- function love.draw()
- love.graphics.setColor(255,255,255)
- love.graphics.rectangle('fill',platform.x, platform.y,platform.w, platform.h)
- love.graphics.rectangle('fill',player.x,player.y,50,50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement