invaders: add pause button

this commit adds 'p' as a pause button to invaders
This commit is contained in:
Gregor Best 2008-11-08 16:27:06 +01:00 committed by Julien Danjou
parent 9789a9cfad
commit 1569818c5e
1 changed files with 4 additions and 0 deletions

View File

@ -77,6 +77,7 @@ function player.new ()
end
function player.move(x)
if not gamedata.running then return false end
local g = gamedata.player:geometry()
if x < 0 and g.x > gamedata.field.x then
@ -89,6 +90,7 @@ function player.move(x)
end
function player.fire()
if not gamedata.running then return false end
if gamedata.ammo == 1 then
gamedata.ammo = 0
local gb = gamedata.player:geometry()
@ -309,6 +311,8 @@ function keyhandler(mod, key)
player.fire()
elseif key == "s" then
awful.util.spawn("import -window root "..gamedata.cachedir.."/invaders-"..os.time()..".png")
elseif key == "p" then
gamedata.running = not gamedata.running
end
end
return true