invaders: add pause button
this commit adds 'p' as a pause button to invaders
This commit is contained in:
parent
9789a9cfad
commit
1569818c5e
|
@ -77,6 +77,7 @@ function player.new ()
|
||||||
end
|
end
|
||||||
|
|
||||||
function player.move(x)
|
function player.move(x)
|
||||||
|
if not gamedata.running then return false end
|
||||||
local g = gamedata.player:geometry()
|
local g = gamedata.player:geometry()
|
||||||
|
|
||||||
if x < 0 and g.x > gamedata.field.x then
|
if x < 0 and g.x > gamedata.field.x then
|
||||||
|
@ -89,6 +90,7 @@ function player.move(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
function player.fire()
|
function player.fire()
|
||||||
|
if not gamedata.running then return false end
|
||||||
if gamedata.ammo == 1 then
|
if gamedata.ammo == 1 then
|
||||||
gamedata.ammo = 0
|
gamedata.ammo = 0
|
||||||
local gb = gamedata.player:geometry()
|
local gb = gamedata.player:geometry()
|
||||||
|
@ -309,6 +311,8 @@ function keyhandler(mod, key)
|
||||||
player.fire()
|
player.fire()
|
||||||
elseif key == "s" then
|
elseif key == "s" then
|
||||||
awful.util.spawn("import -window root "..gamedata.cachedir.."/invaders-"..os.time()..".png")
|
awful.util.spawn("import -window root "..gamedata.cachedir.."/invaders-"..os.time()..".png")
|
||||||
|
elseif key == "p" then
|
||||||
|
gamedata.running = not gamedata.running
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue