Score based on movement upwards

TheodiTheodi Member Posts: 96
edited November -1 in Working with GS (Mac)
Hi everyone, I need some advice on setting up a system for scoring, based on an actors movement upwards, like in papi jump the score goes up as he gets higher. I have tried the following already, but it doesnt work for some reason,

If self.position.x is less than game.heightscore
then
change game.heightscore to self.position.x

I have an actor displaying the game attribute game.heightscore but it stays at 0 and doesn't go up, unless I collect bonus items along the way but thats different.

Any help would be great to resolve this!

Comments

  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    First off you need some sort of event trigger.

    If up is pressed
    If touch is pressed
    If jump is True with a boolean attribute
  • TheodiTheodi Member Posts: 96
    Hey Bamsen, iv tried attaching a event trigger, cant get them to work together though. Could you explain how I would do that?
  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    Try this

    Actor 1
    Display text - Game.highscore

    Actor2 - Your moving actor
    Create rule
    IF attribute self.motion.linearY is > then 0

    Change attribute game.highscore TO self.motion.linearY*10 (or what ever you want)
  • TheodiTheodi Member Posts: 96
    OK here is what happened,

    It displayed the score 3525 and 3200, it kept switching between the 2 as I tapped the actor. The actor is on a scrollable layer which goes up, which the size is 75000 so a long way up.

    It is displaying something at least, but not quite working 100% yet, any ideas why?
  • TheodiTheodi Member Posts: 96
    Having some weird things happening on GS, dont think its anything iv done I havent added anything new apart from the above scoring system.

    The actor is tapped as he comes flying down, then he just keeps bouncing upwards without me tapping him? Like there is an invisible floor, but there isnt.
  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    Send the file to and.oestergaard@gmail.com
    Ill take a Quick look
  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    alright.... here we go

    Create a boolean called moving

    on your moving actor:

    Create Rule
    IF attribute Game.moving is false

    Timer
    Every 0 sec
    Within the timer rule Change attribute Game.highscore TO self.position.Y

    That should do it... hope it helps
  • TheodiTheodi Member Posts: 96
    Perfect mate thanks. BUT, the actor starts quite a bit up out of view, so the score starts at 1000 when it should start at 0. How would i make it start at 0 instead of 1000? I'll try and figure it out.

    Do you know why the actor is bouncing upwards on its own without me clicking it now? I haven't changed anything apart from the score you gave me.
  • TheodiTheodi Member Posts: 96
    The scoring works well, but say the player gets the actor quite high and there score is 10000, if the player then misses the actor it falls down, at the moment it isnt saving the players highest score. The acting falls down, the end game score screen comes up but states they got -44 instead of 10,000.

    How would I set it up to remember the height they got to?
Sign In or Register to comment.