Enemy spawn warning, hero safe for 1 second

ExplosiveGamerExplosiveGamer Member Posts: 33
edited May 2014 in Working with GS (PC)

What I want:
When enemy spawns, it can not deal damage to hero actor right away.

What I tried:
if.
Self.Time > 1
Collision with actor type hero
do
game.life to game.life -1

Outcome:
The hero actor is safe for that 1 second however the enemy can not move from the position the hero collided into it. The enemies are made to follow the hero. Hero positions are shared in game attributes, which is how the enemies follow it.

Any help would be greatly appreciated. Thank you

Comments

  • ogagogag Member Posts: 37

    Create a boolean attribute that says when the actor "can be hurt". Then apply that in a rule. When collision with enemy, you can use a timer, for x seconds, change attribute "can be hurt" to false, minus from score, otherwise change hurt to true.

  • ExplosiveGamerExplosiveGamer Member Posts: 33

    @mariolouis said:
    Create a boolean attribute that says when the actor "can be hurt". Then apply that in a rule. When collision with enemy, you can use a timer, for x seconds, change attribute "can be hurt" to false, minus from score, otherwise change hurt to true.

    Just tried this method. It does not seem to work. I have several enemies spawning in the game. They spawn 1 after another. There can be more than 1 alive.

    When I tried this, the hero actor was not taking damage to its life points at collision and enemies were not destroying themselves at collision instead freezing movement.

  • ExplosiveGamerExplosiveGamer Member Posts: 33

    If anyone else needs help with this here is how I ended up solving this.

    Put a "attack" boolean in the enemy actor
    Set a rule
    if Self.time>1 or how ever long you want
    do change attribute self.attack to true


    To solve the issue with the enemy freezing where the other actor used to be
    set a timer
    ever x seconds
    move to X,Y

    This will keep your enemy actor updated and as well follow your other actor even after they have collided

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @ExplosiveGamer -- nice solution! Thanks for following through and sharing how you solved the issue.

Sign In or Register to comment.