Actor DMG Flash / Overlap-Collide

DessekDessek Member Posts: 14

Hey guys! I have a two part question:

First: I have an actor set to take dmg when it overlaps or collides with an enemy. I also changed it's self.color.blue to 0, and self.color.green to 0 making my actor turn red when overlapping or colliding. It then returns to normal when not overlapping or colliding. I would like to make it flash quickly between red and normal instead of staying constantly red when overlapping or colliding. How can I do this? I've been playing with a timer, but I can't figure out what goes where.

Second: My actor stops taking dmg if I stay overlapped or collided with the enemy actor. I'd like my actor to take dmg every 1 second it overlaps or collides, and if possible I'd like that dmg to line up with the red flash previously stated.

Any help would be great. Thanks!

~Dessek

Best Answers

  • SRPentSRPent Posts: 10
    Accepted Answer

    The first question I don't get the idea that clear, if I get your idea, if you want to make it like if you see how it turns from red to normal, then use a

    rule -> colliding with enemy

    rule -> self.color.red > 0
    constrain attribute->self.color.red -> self.color.red-0.01

    otherwise (from colliding with enemy)->
    rule -> self.color.red < 1
    constrain attribute->self.color.red -> self.color.red+0.01

    with the rule that says if it's colliding/overlapping.

    #

    The second one I just made something like that for a new game of mine. It's be like:

    rule -> colliding with -the thing you want it to collide with-
    -> timer -> every -whichever time you want, I would use 1 though- -> take damage.

    (The take damage thing I put it like that because I don't know the name or way you are implementing damage, but I could say you get my point...)

  • tatiangtatiang Posts: 11,945
    Accepted Answer

    The damage part would be changing the value of an integer actor attribute (set to some value to start, e.g. 10):

    When actor collides with actor [enemy]
         Timer every 1 second
              Change Attribute self.health to self.health-1

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

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

    @Dessek said:
    Hey guys! I have a two part question:

    First: I have an actor set to take dmg when it overlaps or collides with an enemy. I also changed it's self.color.blue to 0, and self.color.green to 0 making my actor turn red when overlapping or colliding. It then returns to normal when not overlapping or colliding. I would like to make it flash quickly between red and normal instead of staying constantly red when overlapping or colliding. How can I do this? I've been playing with a timer, but I can't figure out what goes where.

    Second: My actor stops taking dmg if I stay overlapped or collided with the enemy actor. I'd like my actor to take dmg every 1 second it overlaps or collides, and if possible I'd like that dmg to line up with the red flash previously stated.

    Any help would be great. Thanks!

    ~Dessek

    For the colour just have a timer that returns blue and green to a value of 1 after X seconds . . . so for example:

    Timer - after 0.02 seconds
    Change attribute self.color.blue to 1
    Change attribute self.color.green to 1

    . . . . . . . . .

    I don't know what 'take dmg' means ?

  • DessekDessek Member Posts: 14

    Thanks guys! It means "take damage" Socks. I'll give it a shot and see what happens.

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

    @Dessek said:
    It means "take damage" Socks.

    Ah ! I see, a bit slow today.

Sign In or Register to comment.