36 lines
762 B
Lua
36 lines
762 B
Lua
function keyPressed(key)
|
|
if EnableKeyPress1 == true then
|
|
if key == "space" then
|
|
local bullet = Bullet(UserPlayer1.x + UserPlayer1.width / 2, UserPlayer1.y, 1, BulletImg, 500)
|
|
GameSounds.shoot1:play()
|
|
table.insert(Bullets1, bullet)
|
|
|
|
KeyPressTime1 = KeyDelay1
|
|
EnableKeyPress1 = false
|
|
end
|
|
end
|
|
|
|
if EnableKeyPress2 == true then
|
|
if key == "return" then
|
|
local bullet = Bullet(UserPlayer2.x + UserPlayer2.width / 2, UserPlayer2.y, 2, BulletImg, 500)
|
|
GameSounds.shoot2:play()
|
|
table.insert(Bullets2, bullet)
|
|
|
|
KeyPressTime2 = KeyDelay2
|
|
EnableKeyPress2 = false
|
|
end
|
|
end
|
|
|
|
if key == "escape" then
|
|
love.event.quit()
|
|
end
|
|
if key == "r" then
|
|
GameSounds.bg:stop()
|
|
love.load()
|
|
end
|
|
|
|
if key == "b" then
|
|
Debug = not Debug
|
|
end
|
|
end
|