invaders: replace ammo with round display

this commit replaces the now useless ammo display with a display showing
the current round.
This commit is contained in:
Gregor Best 2008-10-27 17:24:27 +01:00 committed by Julien Danjou
parent adcf32f9ed
commit 2d6c09ee5a
1 changed files with 5 additions and 6 deletions

View File

@ -91,7 +91,6 @@ end
function player.fire() function player.fire()
if gamedata.ammo == 1 then if gamedata.ammo == 1 then
gamedata.ammo = 0 gamedata.ammo = 0
gamedata.field.status.text = gamedata.score.." | "..gamedata.ammo .. " "
local gb = gamedata.player:geometry() local gb = gamedata.player:geometry()
shots.fire(gb.x + 9, gb.y - 10, "#00FF00") shots.fire(gb.x + 9, gb.y - 10, "#00FF00")
end end
@ -146,7 +145,6 @@ function shots.handle()
s:geometry(g) s:geometry(g)
end end
end end
gamedata.field.status.text = gamedata.score.." | "..gamedata.ammo .. " "
end end
@ -251,9 +249,7 @@ function enemies.handle ()
else else
gamedata.score = gamedata.score + 5 gamedata.score = gamedata.score + 5
end end
gamedata.field.status.text = gamedata.score.." | "..gamedata.round.." "
gamedata.field.status.text = gamedata.score.." | "..gamedata.ammo.." "
break
end end
end end
end end
@ -271,6 +267,8 @@ function enemies.handle ()
if gamedata.enemies.number == 0 then if gamedata.enemies.number == 0 then
enemies.setup() enemies.setup()
gamedata.round = gamedata.round + 1
gamedata.field.status.text = gamedata.score.." | "..gamedata.round.." "
if gamedata.enemies.speed > 1 then gamedata.enemies.speed = gamedata.enemies.speed - 1 end if gamedata.enemies.speed > 1 then gamedata.enemies.speed = gamedata.enemies.speed - 1 end
return false return false
end end
@ -483,6 +481,7 @@ function run(args)
gamedata.score = 0 gamedata.score = 0
gamedata.name = "" gamedata.name = ""
gamedata.ammo = 1 gamedata.ammo = 1
gamedata.round = 1
gamedata.btheme = beautiful.get() gamedata.btheme = beautiful.get()
gamedata.cachedir = awful.util.getdir("cache") gamedata.cachedir = awful.util.getdir("cache")
@ -509,7 +508,7 @@ function run(args)
gamedata.field.status = widget({ type = "textbox", gamedata.field.status = widget({ type = "textbox",
name = "status", name = "status",
align = "right" }) align = "right" })
gamedata.field.status.text = gamedata.score.." | "..gamedata.ammo .. " " gamedata.field.status.text = gamedata.score.." | "..gamedata.round .. " "
gamedata.field.caption = widget({ type = "textbox", gamedata.field.caption = widget({ type = "textbox",
name = "caption", name = "caption",