please help. resize target (smaller) after seperate collision (eg: lives)

LivieGamesLivieGames Member Posts: 44
edited February 2016 in Working with GS (Mac)

Im creating a simple game but having dramas with the lives.
Basically when the player hits the target i have interpolated the target to shrink by 50 pixels
This works ok but when i collide with it again nothing happens, i want the target to again shrink by a further 50 pixels

I have setup 2 rules in the player when collide with the target to shrink
ie: target is 150px
collides with player - interpolates to 100px
collide with player again - interpolate to 50px

i set 2 rules but as soon as player collides with target it executes both rules and target shrinks down to 50 after just one collision with player.
How do i create a lives based system where it will only execute each rule individually on collision

Hope this makes sense, im so confused, lol
Cheers

Best Answer

  • adent42adent42 Posts: 3,058
    edited February 2016 Accepted Answer

    Also, to get someone's attention and get better help, I suggest making the subject something related to your actual question: "I need help with resizing an actor based on lives" and then tagging people in the post itself using '@'

    This way the post will show up in someone's feed AND other people can see the content of the post and attempt to help you!

Answers

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,058

    I'd use a separate actor attribute called lives.
    Then on collision, decrement the lives and interpolate based on the life number (so maybe set lives to 3. Interpolate to self.lives * 50 on collision.

    Only worry is how this will stack if you get hit during the interpolation, but this scheme is a start.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Tshirtbooth retired from game making a couple years ago. He is not around these forums anymore.

  • LivieGamesLivieGames Member Posts: 44

    @Lost_Oasis_Games... Oh really! sorry i was unaware, thankyou..

    Sorry folks i am very new here and still working out the kinks

  • LivieGamesLivieGames Member Posts: 44

    @adent42
    Thanks buddy for your reply, will try this and reply soon
    Thankyou so much again for quick response

  • LivieGamesLivieGames Member Posts: 44

    @adent42
    ok so i have created the individual lives (3)
    RULE: overlaps/collide with player
    interpolate. self.size.width to 100
    -Change Att:
    self.lives to self.lives-1
    This works, but:
    it instantly fires next rule which says similar to above but on collision interpolate to 50px

    But i think its still in the process of colliding the first time and firing the next rule
    Is there a way to maybe add a timer here or possibly make it change an attribute that once it collides it will wait till another collision?
    Hope this makes sence.
    Thankyou for any help

  • SocksSocks London, UK.Member Posts: 12,822

    @adent42 said:
    I'd use a separate actor attribute called lives.
    Then on collision, decrement the lives and interpolate based on the life number (so maybe set lives to 3. Interpolate to self.lives * 50 on collision.

    Only worry is how this will stack if you get hit during the interpolation, but this scheme is a start.

    For situations like this I usually make an interruptible interpolate using a constrain like this:

    When value < target
    Constrain value to value+increment

  • LivieGamesLivieGames Member Posts: 44

    Oh nice one SOCKS.
    Will try it now and get back soon
    Thankyou for all support

  • LivieGamesLivieGames Member Posts: 44
    edited February 2016

    ok so i have a game att - color
    in the target actor i have 2 self attributes:
    color and shrink.
    Created a rule:
    All conditions are valid
    overlaps/collides with player
    Att: game.color (does not equal) self.color
    -Interpolate
    self.size.width to self.shrink*50 (shrink attribute is set at 1)

    Then added:
    Change attribute:
    self.lives to self.lives-1

    This seems to be working quite well with all targets but after a few minutes of testing i shot at target with corresponding colored ball so it should have given a point but it interpolated the target? lol must be a bug here somewhere...

    Thankyou again for support guys & any input at all is much appreciated :smiley:

Sign In or Register to comment.