Actor starts with 5000 points

TheodiTheodi Member Posts: 96
edited November -1 in Working with GS (Mac)
Hi!

I have an actor a little way up the screen which is on a timer which makes it fly down. It is supposed to start on 0 points, because as the player "taps" it the atctor goes up and points are added.

But the SCORE at the top of the screen says 5000, when it should be 0 ofcourse! The score monitors the actors Y position and bases it on that as it goes up. So how would i fix this and make the score start at 0 and then go up from there as the acotr goes up?

Comments

  • TheodiTheodi Member Posts: 96
    The rules I have for the score on the actor are

    Rule
    if self.motion > 0
    If game.mainscore is greater or equal to self.position.y
    save attribute game.mainscore key SCORE

    Rule
    If game.moving is fasle
    if self.position.y > game.mainscore

    then

    timer
    every 0 seconds
    change attribute game.mainscore to self.position.y
  • AppsRacKAppsRacK Member Posts: 346
    well it will be 5000 at initial launch since you based the score on actors Y coordinates. Use a timer or make a rule before you constrain the score to your actors Y value so it wont start out at 5000.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Yes, maybe the last line could be: change attribute game.mainscore to self.position.y-5000

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • TheodiTheodi Member Posts: 96
    Ill give that a try thanks
  • TheodiTheodi Member Posts: 96
    So easy when you know how, Thanks to both of you!

    The thing that happens now though is, it starts at 0, when actor goes above it goes up. But if the player misses the actor, the actor flys down, and the score goes into the minuses. I want it to remember where the player got up to, you know? Any ideas?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hmm, perhaps try amending: if self.position.y > game.mainscore to:
    if self.position.y-5000 > game.mainscore

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • AppsRacKAppsRacK Member Posts: 346
    you might need a seperate attibute the records the score while the actor is going up.
    TIMER
    every ? secs
    RULE
    if livescore>actual score
    livescore = livescore + (certain factor)
    actual score = livescore.
    otherwise
    actual score = livescore.

    you might test this one out coz im not really sure if this will work i type this on PC while im on my day Job. lolz.

    :)
  • TheodiTheodi Member Posts: 96
    Good idea, but I cant type text into the attribute box can I? it doesn't seem to let me put the -5000 in.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Double-click the zero, and you'll get a box to type in your values, if you mean where the scene/game attributes are made. Or if you mean in the Actor Editor's window, you have to click the "e" symbol to get type it in the Expression Editor.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • TheodiTheodi Member Posts: 96
    gyroscope said:
    Hmm, perhaps try amending: if self.position.y > game.mainscore to:
    if self.position.y-5000 > game.mainscore

    How would I do this? Its in the Actor Editors window?
    I put self.position.y-5000 in the expression editor. But as you said try switching them around. But I cant type -5000 in the first box of change attribute.

    If I click on it to type, or double click, it comes up with the attribute browser.
  • TheodiTheodi Member Posts: 96
    OK, this is what I have.

    Rule
    if self.motion > 0
    If game.mainscore is greater or equal to self.position.y
    save attribute game.mainscore key SCORE

    Rule
    If game.moving is fasle
    if self.position.y > game.mainscore <--- I am trying to put -5000 after self.position.y but it wont let me.
  • TheodiTheodi Member Posts: 96
    I managed to do it.

    Rule
    if self.motion > 0
    If game.mainscore is greater or equal to self.position.y-5000 <--- I put it here, this way it remembers their top
    score and shows it on the end game screen. save attribute game.mainscore key SCORE

    When they are playing the game though it still goes into the minuses.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Oh, I see what you mean - I guess you'll need a real attribute called PosYfollow. (This is off the top of my head, not tested). Constrain Attribute PosYfollow To self.position.y-5000. THen put if PosYFollow > game.mainscore. Fingers crossed that'll work for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • TheodiTheodi Member Posts: 96
    Ok I'll try that now.
  • TheodiTheodi Member Posts: 96
    Yes it worked! well done Gyro, thanks.

    Can you explain why that worked? It was the Real attribute that did it?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Theodi said:
    It was the Real attribute that did it?

    Yes, and it's in custody awaiting trial. ;-) seriously, yes, the real attribute is more "detailed" when constraining to the y position, rather than using an integer. Glad you've got it working now. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.