Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- text = ""
- x = 0
- y = 0
- local angle = 0
- function love.load()
- gfx = love.graphics
- player = {
- x = 25,
- y = 25
- }
- player2 = {
- x = 400,
- y = 300
- }
- love.graphics.setBackgroundColor( 150, 150, 150)
- soldier = gfx.newImage("soldier.png")
- Cursor = gfx.newImage("crosshair.png")--Wczytuje celownik
- moon = gfx.newImage("moon.png")
- love.mouse.setVisible(false) --Ukrywa myszke
- medium = gfx.newFont(45)
- end
- function love.draw()
- --love.graphics.translate(-player.x + 400, -player.y + 300)
- x = love.mouse.getX()
- y = love.mouse.getY()
- love.graphics.line(400 - 0, 300 -0, x, y)
- local kat = math.atan2(y - (player2.y), x - (player2.x))
- gfx.draw(soldier,player2.x, player2.y, kat+math.pi/2, 1, 1, 20, 20, 0, 0)
- gfx.draw(Cursor,love.mouse.getX(),love.mouse.getY(),0, 1, 1, 12, 12) --Celownik
- gfx.draw(moon, player.x, player.y)
- gfx.setFont(medium)
- gfx.print(text, player.x, player.y)
- gfx.print(kat, 0,0)
- end
- function love.update(dt)
- if love.keyboard.isDown("w") then
- player.y = player.y + 2
- end
- if love.keyboard.isDown("s") then
- player.y = player.y - 2
- end
- if love.keyboard.isDown("a") then
- player.x = player.x + 2
- end
- if love.keyboard.isDown("d") then
- player.x = player.x - 2
- end
- if love.keyboard.isDown("lshift") and love.keyboard.isDown("s") then
- player.y = player.y - 2.5
- end
- if love.keyboard.isDown("lshift") and love.keyboard.isDown("w") then
- player.y = player.y + 2.5
- end
- if love.keyboard.isDown("lshift") and love.keyboard.isDown("d") then
- player.x = player.x - 2.5
- end
- if love.keyboard.isDown("lshift") and love.keyboard.isDown("a") then
- player.x = player.x + 2.5
- end
- function love.keypressed(key)
- if key == "escape" then
- love.event.push("quit")
- end
- end
- end
Add Comment
Please, Sign In to add comment