Code:
dynamic public class Design_3_3_hud extends SceneScript
{
public var _nextscene:Scene;
public var _thislevelnumber:Number;
public function Design_3_3_hud(param1, param2:GameState)
{
super(param2);
nameMap["next scene"] = "_nextscene";
nameMap["this level number"] = "_thislevelnumber";
return;
}// end function
override public function init() : void
{
doesCustomDrawing();
setGameAttribute("score", 10000);
setGameAttribute("landingtimer", 200);
setGameAttribute("winlosestatus", 0);
setGameAttribute("clicktimer", 0);
setGameAttribute("jack_hit_floor", false);
createActor(getActorType(24), 545, -5, FRONT);
createActor(getActorType(26), 425, 29, FRONT);
createActor(getActorType(16), 100, 100, FRONT);
createActor(getActorType(51), 438, 455, FRONT);
return;
}// end function
override public function update() : void
{
if (sameAs(getGameAttribute("winlosestatus") as Number, 0))
{
setGameAttribute("clicktimer", (getGameAttribute("clicktimer") as Number) - 1);
setGameAttribute("score", (getGameAttribute("score") as Number) - 1);
if (getGameAttribute("jack_hit_floor") as Boolean)
{
setGameAttribute("landingtimer", (getGameAttribute("landingtimer") as Number) - 1);
if ((getGameAttribute("landingtimer") as Number) <= 0)
{
sayToScene("CPMStar Ads", "loadAdAt", 150, 20);
setGameAttribute("winlosestatus", 2);
}
}
}
if (sameAs(getGameAttribute("winlosestatus") as Number, 1))
{
sayToScene("CPMStar Ads", "loadAdAt", 150, 20);
playSound(getSound(46));
createActor(getActorType(28), 140, 280, FRONT);
setGameAttribute("winlosestatus", 3);
}
if (sameAs(getGameAttribute("winlosestatus") as Number, 2))
{
if ((getGameAttribute("levelcompletednumber") as Number) < this._thislevelnumber)
{
setGameAttribute("levelcompletednumber", this._thislevelnumber);
saveGame("mySave", "mySave", function (score:Boolean) : void
{
return;
}// end function
);
}
playSound(getSound(45));
createActor(getActorType(32), 160, 260, FRONT);
setGameAttribute("winlosestatus", 3);
runLater(1000 * 1, function (score:TimedTask) : void
{
createActor(getActorType(30), 220, 320, FRONT);
return;
}// end function
, null);
}
if (sameAs(getGameAttribute("winlosestatus") as Number, 4))
{
setGameAttribute("winlosestatus", 5);
switchScene(this._nextscene.getID(), createFadeOut(1000 * 0.5), createFadeIn(1000 * 0.5));
}
if ((getGameAttribute("score") as Number) <= 0)
{
setGameAttribute("score", 0);
}
return;
}// end function
override public function draw(score:Graphics, score:Number, score:Number) : void
{
score.setFontColor(Util.RGBToHex(255, 255, 255));
score.drawString("" + "score", 20, 5);
score.drawString("" + (getGameAttribute("score") as Number), 80, 5);
if ((getGameAttribute("clicktimer") as Number) > 0)
{
setGameAttribute("degree", 360 - Util.toRadians((getGameAttribute("clicktimer") as Number) / (getGameAttribute("maxclicktimer") as Number) * 360));
score.setStrokeColor(Util.RGBToHex(255, 51, 51));
score.setStrokeThickness(2);
score.drawCircle(getMouseX(), getMouseY(), 19);
score.drawLine(getMouseX(), getMouseY(), getMouseX(), getMouseY() + 20);
score.drawLine(getMouseX(), getMouseY(), getMouseX() + 20 * Math.cos(getGameAttribute("degree") as Number), getMouseY() + 20 * Math.sin(getGameAttribute("degree") as Number));
}
if (getGameAttribute("jack_hit_floor") as Boolean && sameAs(getGameAttribute("winlosestatus") as Number, 0))
{
score.drawString("" + "SAFE", 200, 28);
score.setStrokeColor(Util.RGBToHex(102, 102, 255));
score.drawRect(200, 50, 240, 25);
score.setStrokeColor(Util.RGBToHex(153, 0, 153));
score.setColor(Util.RGBToHex(255, 200, 0));
score.fillRect(200, 50, (getGameAttribute("landingtimer") as Number) / 200 * 240, 25);
}
return;
}// end function
override public function forwardMessage(score:String) : void
{
return;
}// end function
}
you have to changed the following line to unlock the levels after completing the first level