Get points when jump over

Fredrik BixoFredrik Bixo Member Posts: 239
edited November -1 in Working with GS (Mac)
Hi , I'm making a new game and now and I have a big problem. I want to get the score +1 when i jump over another actor.I already know how to get score +1 but the problem is that i don't now how to get it when my main actor jump over another actor . I've already tried change attribute x and y to self position every 0.1 sec on my "jump over" actor and then the same on my main actor but instead x2, y2 and then if x2 and y2 is > or < than x or y change attribute score to +1. I'm probably thinking completely wrong... any ideas?

Comments

  • TheBoss_123TheBoss_123 Member Posts: 60
    Place an invisible actor ontop and do a collision check
    If collision with invisible actor
    points + 1

    Cheers
    TheBoss_123
  • Fredrik BixoFredrik Bixo Member Posts: 239
    thanks. Sorry I forgot to say that the "jump over" actor are moving up'n down
  • svnsvn Member Posts: 445
    Here's a better idea. Put the actors you want jumped over in the scene. Then,tell your jumping actor: When (self.position.Y) and (self.position.X) is Greater Than (jumpedactor.position.Y) and (jumpedactor.position.Y). Now you don't need any extra actor!
  • micksolomicksolo Member Posts: 264
    svn is right, you'll also need to create global attributes for the jumping enemies

    JumpEnemeyPosX
    JumpEnemeyPosY

    And constrain the jump enemies Self Pos X and Self Pos Y to those global attributes

    Then in the player actor set up a rule like:

    attribute Self Pos X > Jump EnemyPosX
    attribute Self Pos Y > Jump EnemyPosY

    Chg attribute Score to true

    Then setup up a score rule somewhere else:
    When Score = true
    Chg Attribute TotalScore to TotalScore + 1

    The reason I did it like that is because you'll probably have more than one instance of this actor and it might confuse GS with the global attributes.

    The other alternative is to do like the first guys reply, each enemy spawns an invisible collision box above them which is constrained to the X Pos and Y pos (+ how ever many pixels above you want it ot appear), then when the player collides with the collision box it adds a score.
  • Fredrik BixoFredrik Bixo Member Posts: 239
    thanks! How can I make global attributes? :)
Sign In or Register to comment.