invaders: code cleanup

This commit is contained in:
Gregor Best 2008-10-27 17:12:04 +01:00 committed by Julien Danjou
parent 7c20b14ce5
commit 3895c0cde9
1 changed files with 6 additions and 6 deletions

View File

@ -78,15 +78,15 @@ function player.new ()
end end
function player.move(x) function player.move(x)
local gb = gamedata.player:geometry() local g = gamedata.player:geometry()
if x < 0 and gb.x > gamedata.field.x then if x < 0 and g.x > gamedata.field.x then
gb.x = gb.x + x g.x = g.x + x
elseif x > 0 and gb.x < gamedata.field.x + gamedata.field.w - 30 then elseif x > 0 and g.x < gamedata.field.x + gamedata.field.w - 30 then
gb.x = gb.x + x g.x = g.x + x
end end
gamedata.player:geometry(gb) gamedata.player:geometry(g)
end end
function player.fire() function player.fire()