Continuously changing attribute while overlapped. Help?

foldifoldi Member Posts: 21
edited November -1 in Working with GS (Mac)
I'm trying to continuously change an actor A's health value while it's touching actor B. However, I can only get health to decrement once when the collision is first detected. How can I keep decrementing and stop decrementing if the actors separate before actor A's health equals 0?

Thanks!

Comments

  • hrsmediahrsmedia Member Posts: 522
    Maybe try putting a timer, when collide every .. seconds change attribute.
  • quantumsheepquantumsheep Member Posts: 8,188
    On your enemy actor make an attribute called 'Life'

    Then...

    When enemy overlaps with laser:

    Timer (run to completion checked)
    every .2 seconds

    Change attribute self.life to self.life-1

    That should do it - works on my project just fine.

    Hope that helps,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • GRIDGRID Member Posts: 30
    I love it, whenever I read these 'help' posts i get a billion* new ideas for games.

    *Rough estimate, might be as low as 2 or 3
  • foldifoldi Member Posts: 21
    Timer took care of it. Thanks!
Sign In or Register to comment.