added sounds and key delay
This commit is contained in:
parent
e75d705e9b
commit
2e6fdcd3f0
22
main.lua
22
main.lua
@ -19,8 +19,26 @@ function love.load()
|
||||
ScrnHeight = love.graphics.getHeight()
|
||||
ScrnWidth = love.graphics.getWidth()
|
||||
|
||||
UserPlayer1 = Player(400, ScrnHeight - 30, 1, 3, "player1.png", 300)
|
||||
UserPlayer2 = Player(200, 0, 2, 3, "player2.png", 300)
|
||||
EnableKeyPress = true
|
||||
KeyPressTime = 0
|
||||
KeyDelay = 0.5
|
||||
|
||||
GameSounds = {}
|
||||
--static, loaded into memory all time
|
||||
--stream, loaded into memory when played
|
||||
GameSounds.shoot1 = love.audio.newSource("/sounds/shoot1.wav", "static")
|
||||
GameSounds.shoot2 = love.audio.newSource("/sounds/shoot2.wav", "static")
|
||||
GameSounds.hit = love.audio.newSource("/sounds/hit.wav", "static")
|
||||
GameSounds.bg = love.audio.newSource("/sounds/bgmusic.wav", "stream")
|
||||
|
||||
GameSounds.bg:setLooping(true)
|
||||
GameSounds.bg:setVolume(0.5)
|
||||
GameSounds.bg:play()
|
||||
|
||||
local player1Img = "/assets/player1.png"
|
||||
local player2Img = "/assets/player2.png"
|
||||
UserPlayer1 = Player(400, ScrnHeight - 30, 1, 3, player1Img, 300)
|
||||
UserPlayer2 = Player(200, 0, 2, 3, player2Img, 300)
|
||||
|
||||
Bullets1 = {}
|
||||
Bullets2 = {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user