"Wait" in Enemy Attack Phase

Get help using Construct 2

Post » Mon Feb 18, 2013 6:13 pm

I have tried so many combinations for a week now, and this (simple?) action will not behave for me.

Fighting game, 1 player and 1 enemy. The following is simplified to show the problem. Sprite animations are in "quotes".

GAMEPLAY
While in "Idle" (not moving) pose, the enemy should "Attack" once every 4 seconds. This works fine.
If player attacks enemy during "Idle", the enemy should "Block" then return to "Idle".
Similarly, if player "Dodge"s enemy's attack, enemy should be "Dazed", then return to "Idle".

The nemy will sometimes attack directly out of the "block" or "Dazed" animation instead of waiting 4 seconds.

Here are my events as I have them now:

1.(Glob.Var.)AttackType=0
    Is anim "Idle" playing   :   Set AttackType to 1
    X Is anim "Idle" playing : Set AttackType to 0

2.AttackType=1 : Wait 4 secs, Set anim to "Attack", Set AttackType to 0
Trigger once :

Thank you in advance!
B
6
Posts: 13
Reputation: 782

Post » Mon Feb 18, 2013 9:04 pm


The wait timer begins, and if enemy blocks at, say, 2 second mark, it will carry out the post-wait action 2 seconds later.

I can't figure out how to "cancel" or "stop" the wait command. In other words, if something interrupts an event before its post-wait action occurs, how do I stop the post-wait action from occuring?

Here is another attempt, which gives these results:

B
6
Posts: 13
Reputation: 782

Post » Mon Feb 18, 2013 9:09 pm

Trying to post image again...

http://www.flickr.com/photos/93326820@N05/8486076523/
B
6
Posts: 13
Reputation: 782

Post » Tue Feb 19, 2013 8:58 am

Not 100% clear on this,as I cant see in your conditions what is triggering your idle animation...but will try to help,but I think you need to rework it a little..

Also it would be better to use delta time rather than seconds as it would run the same speed on high and low spec machines

play about with the delta time reduction to get the timing you want


>if attacktype is greater than 0...subtract 1.0*dt from attacktype

>if attacktype=0....do idle animation...
Pixel perfick2013-02-19 09:05:49
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Tue Feb 19, 2013 10:56 pm

Thanks for the reply.

My real questions is:
I want the enemy to (basically) attack every 4 seconds ONLY if he is in his "Idle" animation.
If his idle is interrupted, say by blocking the player's attack, I want his 4 second timer to reset.
So every time his "Idle" animation starts, a 4 second countdown begins to his attack. I can't figure out how to implement this--how to have an action interrupt/cancel/restart/etc. the wait command from a previous event.


p.s. The image I posted above contains only a small portion of the event sheet--enemy is set to "Idle" on finish of several other animations.

As for dt, yes, I plan on implementing that in the future--trying to get the core gameplay working first. Lots to learn!
B
6
Posts: 13
Reputation: 782

Post » Tue Feb 19, 2013 11:50 pm

Ah I see..set your first condition as before...but add a sub event should work

.AttackType=1 : Wait 4 secs,
sub event
>animation idle is playing >Set anim to "Attack", SetAttackType to 0
Trigger once :

but DT still better way to go when you find your feet..
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260


Return to How do I....?

Who is online

Users browsing this forum: currypuff, makotto, randomly, Walessio and 26 guests