End of game

Hi in my game i have it where if your previous score is not higher than your high score then i interpolate the camra down. If your score is better than what you got interpolate camera up.

I tried lots of ways of doing this but could find the right one. So what i basically need is if high score is higher go up And if high score is lower go down i tried this but it all ways ends up going down any ideas any one

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    Did you try interpolating the camera.origin.Y to a new value?

    If you can type out or post a screenshot of your rules, we can figure out why it's not working.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    Ok I will do
  • mrcameron999mrcameron999 Member Posts: 182
    Right so hears what i have got.

    RULE
    if game.lose =< 0
    If game.highscore < game.score
    DO
    Interpolate camera to 960 for 2 seconds using esae in and out.
    Change attribute game.score to game.higscore
    Save game.highscore as score
    ELSE(I wasn't too sure what this was for and it sound right where i should put the rest)
    game.lose =< 0
    game.score =< game.highscore
    DO
    interpolate camera to 0 with ease in and out for 2 seconds

    Hope this helps(My print screen doesn't work so i had to type it)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I'm not sure what game.lose represents in your game but are you sure that that attribute is less than or equal to zero at the end of your game? Try adding a DisplayText behavior or log debugging statement so that you can watch the value of it when the game is ending.

    The "else" section just means that if the rule condition(s) is(are) not true. I assume you have the rule set to ALL conditions and not ANY? If so, then the else section will run whenever game.lose > 0 or game.highscore >= game.score. But since you have another set of rule conditions inside of the else section, that portion of your code will NEVER run because the conditions contradict each other. Game.lose can't be > 0 and also <= 0.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    Right ok i get what your saying. game.lose is when u touch an acotr u lose 1 life and you get 3 so when its 3 do this
    and how do say then that i the rule with game.highscore is < than score do this one not
    game.hoghscore > game.score
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    If attribute game.lose <= 0
         If game.score > game.highscore
              Interpolate scene.camera.origin.Y to 960
              change attribute game.highscore to game.score
              save attribute game.highscore
         else
              Interpolate scene.camera.origin.Y to 0

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    Omg i'm soooo stuip thanks sir
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Omg i'm soooo stuip thanks sir
    We've all been there. ;) You're welcome!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    edited January 2014
    Um problem when i press play it goes to 0 in y cords and the game gliches sorta
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Um problem when i press play it goes to 0 in y cords and the game gliches sorta
    So this is where you need to be able to troubleshoot your own game. I can't see what other rules you have. If you want to post them, we can go from there. My guess is that either you didn't set up the rule I posted correctly (the outer rule is If game.lose <= 0, which should only be true when you lose, right?) or your value for game.lose is starting out at 0 or negative and causing that rule to fire.

    One way to troubleshoot is to use a DisplayText actor or a log debugging statement with game.lose in the expression editor and watch the actor Debugger window to see what value game.lose is actually starting with.

    Also, unless you have other camera rules somewhere or have changes the default value, the default value for scene.camera.origin.Y is in fact zero.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    I defently setup your rule correct i set the normal to 480. When i remove the rule for ELSE
    interpolate it works?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    i set the normal to 480.
    I don't know what that means. Did you use a Change Attribute behavior or did you set the initial value in the attribute inspector?

    And what happened with the DisplayText/debugging? What did you discover about the value of game.lose at the start of the game?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    Game.lose was always 3 when it started ''i set normal to 480'' That was the size of where you go to at the start of the scene
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    The rule I posted...
    If attribute game.lose ≤ 0
         If game.score > game.highscore
              Interpolate scene.camera.origin.Y to 960
              change attribute game.highscore to game.score
              save attribute game.highscore
         else
              Interpolate scene.camera.origin.Y to 0
    ...will not run at all if game.lose > 0. Try putting a log debugging statement inside of each rule condition and above the first rule. So basically, like this:

    Log Debugging Statement ["1"]
    If attribute game.lose ≤ 0
         Log Debugging Statement ["2"]
    If game.score > game.highscore
              Log Debugging Statement ["3"]
              Interpolate scene.camera.origin.Y to 960
              change attribute game.highscore to game.score
              save attribute game.highscore
    else
              Log Debugging Statement ["4"]
               Interpolate scene.camera.origin.Y to 0


    When you do that, what does the Debugger window show?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    Sorry i don't really understand what your wanting me to do. I tried dragging log statement in but it wouldn't let me?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I assume you're working in Windows Creator so the look will be different but the idea should be the same:

    http://gamesalad.com/blog/question-of-the-week-using-the-debugger

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mrcameron999mrcameron999 Member Posts: 182
    edited January 2014
    I put 1,3,4 Statements in but i couldn't in where you want me to put two this is what i got.
    1 4
  • mrcameron999mrcameron999 Member Posts: 182
    I assume you're working in Windows Creator so the look will be different but the idea should be the same:

    http://gamesalad.com/blog/question-of-the-week-using-the-debugger
    I under stand that but it wont let me where u say to put log debug statement it has a red cross on my cursor
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I'm not sure why it won't let you but because you're seeing "1" and "4" it tells me that game.lose ≤ 0 and game.score < game.highscore. So it's up to you to figure out why game.lose is not in fact 3 when the game starts (or shortly thereafter). I sent you a PM as well, so if you need further help please follow my instructions there.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.