SHARE
TWEET

Pyry

a guest Feb 21st, 2009 117 Never
  1. -- Example: Moving stuff with the keyboard
  2.  
  3. x, y = 400, 300
  4.  
  5. function load()
  6.     image = love.graphics.newImage("images/love-ball.png")
  7. end
  8.  
  9. function update(dt)
  10.     if love.keyboard.isDown(love.key_left) then
  11.         x = x - 100 * dt
  12.     end
  13.     if love.keyboard.isDown(love.key_right) then
  14.         x = x + 100 * dt
  15.     end
  16.     if love.keyboard.isDown(love.key_up) then
  17.         y = y - 100 * dt
  18.     end
  19.     if love.keyboard.isDown(love.key_down) then
  20.         y = y + 100 * dt
  21.     end
  22. end
  23.  
  24. function draw()
  25.     love.graphics.draw(image, x, y)
  26. end
RAW Paste Data
Top