Advertisement
TheZipCreator

Untitled

Apr 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. platform = {}
  2. player = {}
  3. movement = {}
  4.  
  5. function love. load()
  6. platform.w = love.graphics.getWidth()
  7. platform.h = love.graphics.getHeight()
  8. movement.x = 1;
  9. movement.y = 1;
  10.  
  11. platform.x = 0
  12.  
  13. platform.y = platform.h / 2
  14. player.x = platform.w / 2.4
  15. player.y = platform.h / 2.4
  16.  
  17.  
  18. player.speed = 200
  19.  
  20.  
  21.  
  22.  
  23. end
  24. function love.update(dt)
  25. if love.keyboard.isDown('d') then
  26. player.x = player.x + (movement.x * dt)
  27. elseif love.keyboard.isDown('a') then
  28. player.x = player.x - (movement.x * dt)
  29. end
  30. end
  31. function love.draw()
  32. love.graphics.setColor(255,255,255)
  33.  
  34. love.graphics.rectangle('fill',platform.x, platform.y,platform.w, platform.h)
  35. love.graphics.rectangle('fill',player.x,player.y,50,50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement