10
« on: February 04, 2013, 08:35:10 am »
Hi,
I attached the code below, Where should I make the change? Sorry for bothering you.I really appreciate your time.
public dynamic class Design_242_242_ScoreKeeper extends SceneScript
{
public var _DisplayFont:Font;
public var _Duration:Number = 0.0;
/* Params are:__NumPoints */
public function AddPoints(__NumPoints:Number):void
{ /* This can be called from anywhere.See the Bumper actor behavior. */
setGameAttribute("Score", ((getGameAttribute("Score") as Number) + __NumPoints));
}
override public function init():void
{
addWhenUpdatedListener(null, function(list:Array):void {
if(wrapper.enabled){
if(sameAs(getCurrentSceneName(), "Level 1"))
{
if(((getGameAttribute("Score") as Number) > 10000))
{
switchScene(1, createFadeOut(((1000*2))),createFadeIn(((1000*0))));
}
}
if(sameAs(getCurrentSceneName(), "Level 2"))
{
if(((getGameAttribute("Score") as Number) > 20000))
{
switchScene(2, createFadeOut(((1000*2))),createFadeIn(((1000*0))));
}
}
if(sameAs(getCurrentSceneName(), "Level 3"))
{
if(((getGameAttribute("Score") as Number) > 30000))
{
switchScene(3, createFadeOut(((1000*2))),createFadeIn(((1000*0))));
}
}
if(sameAs(getCurrentSceneName(), "Level 4"))
{
if(((getGameAttribute("Score") as Number) > 40000))
{
switchScene(0, createFadeOut(((1000*2))),createFadeIn(((1000*0))));
}
}
}
});
addWhenDrawingListener(null, function(list:Array, g:Graphics, x:Number, y:Number):void {
if(wrapper.enabled){
g.setFont(_DisplayFont);
g.drawString("" + (getGameAttribute("Score") as Number), 16, 16);
}
});
}
public function Design_242_242_ScoreKeeper(ignore:*, scene:GameState)
{
super(scene);
nameMap["Display Font"] = "_DisplayFont";
nameMap["Duration"] = "_Duration";
}
override public function forwardMessage(msg:String):void
I just created my own code for a score keeper but I am not sure where I should make the change?
{
addSceneCollisionListener(getActorType(475), getActorType(477), function(list:Array, event:Collision):void {
if(wrapper.enabled){
setGameAttribute("Score", ((getGameAttribute("Score") as Number) + 0));
}
});
addWhenDrawingListener(null, function(list:Array, g:Graphics, x:Number, y:Number):void {
if(wrapper.enabled){
g.drawString("" + (getGameAttribute("Score") as Number), 25, 10);
}
});