Temporally freeze enemy on timer if hit

Hello community,

Noob here again - sorry.
I’m working on a run-around type game. Player runs and is chased by enemy.
on Enemy, I have a variable = ‘stun’ = 0;

if player sword (animation #2) touches enemy, then set stun = 1.

Apologies if this gets confusing.

I also have this:

So, the idea is… if player attack hits enemy… freeze enemy for xx seconds and resume chase.

Hope this helps.

I have a feeling my code is messy and I’ve gotten myself in a tis.

Thanks,
rob

1 Like

testing the timer works

This does delete the player.

Hi Rob,

You’re missing a “Trigger Once” condition here:


This means that the stun timer is reset to 0 every frame.
Make a sub event, put the “Start (or reset)” event into it, and add a Trigger Once condition should make it work.

I cannot comment on your code’s tidiness as it’s 12am here…

Hope that helps

1 Like

Thanks @reina,


I ditched the line and went with this and it seems to work now :slight_smile: YAY!!!

1 Like