Need help correcting my score board, I would like it to reset after you die.

Panooch77

  • Posts: 20
Hi,
I recently posted my first game Gorilla Madness and I really want to update the score feature so that it resets after you die. I used a score keeper feature from stencyl forge but I have no idea how to update the board so it resets. I tried to create a test game and use score packs but had no luck. If some one could help I would appreciate the advice. If you know a forge feature to use or have solid tutorial that explains it that would be great or if you really feel helpful and want to type out the steps I would be very grateful.

Thanks

Tuo

  • *
  • Posts: 2469
Scores are generally stored in game attributes, so when the main character dies, after submitting the score, set the corresponding game attributes to 0 (or whatever is their default).
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

Panooch77

  • Posts: 20
Hi,
I went to game settings than attributes. The category is scoring and number is already set to 0.0. still can't get it to work.
Thanks though,

Tuo

  • *
  • Posts: 2469
Not in the settings tab, but rather in the coding for the character dying.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

Panooch77

  • Posts: 20
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);
}
});

Tuo

  • *
  • Posts: 2469
I don't see the "game over" part of the code in that section. That is where it would go. For example, when does the player hit the enemey?
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

Panooch77

  • Posts: 20
Thank you, I really need to figure this out. I have been looking at tutorials all day from sunrise and final boss but neither really explain how I can add the "game over" aspect. I was able to practice adding a lives meter but when the lives ran out I could get game to end. Thanks for the time your taking helping me out.
It is greatly appreciated.

Tuo

  • *
  • Posts: 2469
Okay, so then in the coding for the lives running out, after you submit the score, set it to zero there.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

Panooch77

  • Posts: 20
I did some updating today, what do you think? I figured how to get score to reset to zero but then I also figured out how to make a live counter so I let score continue but they only have four tries.

Thanks,
http://www.stencyl.com/game/play/16929