Guest User

Untitled

a guest
Jul 29th, 2017
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. function love.load()
  2. require("main")
  3. walls = love.graphics.newImage("walls.png")
  4. WallOneX = 300
  5. WallOneY = 200
  6. WallOneWidth = 160
  7. WallOneHeight = 16
  8. WallTwoX = 300
  9. WalTwoY = 260
  10. WallTwoWidth = 160
  11. WallTwoHeight = 16
  12. end
  13.  
  14. function love.update(dt)
  15. -- collisions
  16. -- one collision
  17. if PlayerY - PlayerHeight/2 <= WallOneY + WallOneHeight and PlayerY + PlayerHeight/2 >= WallOneY and PlayerX + PlayerWidth/2 >= WallOneX and PlayerX - PlayerWidth/2 <= WallOneX + WallOneWidth then
  18. lost = 1
  19. end
  20. -- two collision
  21. if PlayerY - PlayerHeight/2 <= WalTwoY + WallTwoHeight and PlayerY + PlayerHeight/2 >= WalTwoY and PlayerX + PlayerWidth/2 >= WallTwoX and PlayerX - PlayerWidth/2 <= WallTwoX + WallTwoWidth then
  22. lost = 1
  23. end
  24. end
  25.  
  26. function love.draw()
  27. -- draw walls
  28. love.graphics.draw(walls, WallOneX, WallOneY)
  29. love.graphics.draw(walls, WallTwoX, WalTwoY)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment