Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function love.load()
- require("main")
- walls = love.graphics.newImage("walls.png")
- WallOneX = 300
- WallOneY = 200
- WallOneWidth = 160
- WallOneHeight = 16
- WallTwoX = 300
- WalTwoY = 260
- WallTwoWidth = 160
- WallTwoHeight = 16
- end
- function love.update(dt)
- -- collisions
- -- one collision
- if PlayerY - PlayerHeight/2 <= WallOneY + WallOneHeight and PlayerY + PlayerHeight/2 >= WallOneY and PlayerX + PlayerWidth/2 >= WallOneX and PlayerX - PlayerWidth/2 <= WallOneX + WallOneWidth then
- lost = 1
- end
- -- two collision
- if PlayerY - PlayerHeight/2 <= WalTwoY + WallTwoHeight and PlayerY + PlayerHeight/2 >= WalTwoY and PlayerX + PlayerWidth/2 >= WallTwoX and PlayerX - PlayerWidth/2 <= WallTwoX + WallTwoWidth then
- lost = 1
- end
- end
- function love.draw()
- -- draw walls
- love.graphics.draw(walls, WallOneX, WallOneY)
- love.graphics.draw(walls, WallTwoX, WalTwoY)
- end
Advertisement
Add Comment
Please, Sign In to add comment