sillybear's life meter battery patch.

This commit is contained in:
Colby Klein
2012-01-06 23:48:04 -08:00
parent 1212d234b2
commit 3a74385ae4
2 changed files with 29 additions and 6 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

+29 -6
View File
@@ -1,24 +1,47 @@
local player = Var "Player"
local blinkTime = 1.2
local barWidth = 256;
local barHeight = 32;
local t = Def.ActorFrame{
Def.Quad{
InitCommand=cmd(diffuse,color("#666666");zoomto,barWidth,barHeight);
};
Def.Quad{
InitCommand=cmd(diffuse,color("#000000");zoomto,barWidth,barHeight;fadetop,1);
};
LoadActor("_lives")..{
-- xxx: assumes course is 4lives (or more)
InitCommand=cmd(pause;setstate,3);
InitCommand=cmd(pause;horizalign,left;x,-(barWidth/2));
BeginCommand=function(self,param)
local screen = SCREENMAN:GetTopScreen();
local glifemeter = screen:GetLifeMeter(player);
self:setstate(glifemeter:GetTotalLives()-1);
if glifemeter:GetTotalLives() <= 4 then
self:zoomx(barWidth/(4*64));
else
self:zoomx(barWidth/((glifemeter:GetTotalLives())*64));
end
self:cropright((640-(((glifemeter:GetTotalLives())*64)))/640);
end;
LifeChangedMessageCommand=function(self,param)
if param.Player == player then
if param.LivesLeft == 0 then
self:visible(false)
elseif param.LivesLeft <= 4 then
self:setstate( math.max(param.LivesLeft-1,0) )
self:visible(true)
else
self:setstate(3)
self:setstate( math.max(param.LivesLeft-1,0) )
self:visible(true)
end
end
end;
StartCommand=function(self,param)
if param.Player == player then
self:setstate( math.max(param.LivesLeft-1,0) );
end
end;
FinishCommand=cmd(playcommand,"Start");
};
};
return t;