-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.lua
46 lines (40 loc) · 869 Bytes
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require("shurikens")
require("conf")
local Sound = require("sounds")
local x = 150
local y = 150
local characterSpeed = 5
function handleMovement()
if love.keyboard.isDown('d') then
x = x + characterSpeed
end
if love.keyboard.isDown('s') then
y = y + characterSpeed
end
if love.keyboard.isDown('a') then
x = x - characterSpeed
end
if love.keyboard.isDown('w') then
y = y - characterSpeed
end
end
function love.update(dt)
updateShurikens()
handleMovement()
Sound:Update()
end
function love.load()
sprite = love.graphics.newImage("ogre.png")
Sound:inprint('gs', 'cannonshot.mp3', 'static')
loadShuriken()
end
function love.draw()
love.graphics.draw(sprite, x, y)
drawShurikens()
end
function love.keypressed( key, scancode, isrepeat )
if key == "space" then
Sound:play("gs")
createShuriken(x, y)
end
end