Solved - How do I command something only for the first time

Get help using Construct 2

Post » Wed Aug 06, 2014 12:00 pm

Hello all

I have a game where the ball hits the enemy and level won. After the ball hits the enemy I have a small animation clip for a second . But the animation starts again and again as the ball touches the enemy over and over.

How do I cmd something like only when it happens the first time.

Thanks for the help in advance
Last edited by animator on Fri Aug 08, 2014 3:40 pm, edited 1 time in total.
B
7
S
1
Posts: 51
Reputation: 507

Post » Wed Aug 06, 2014 12:15 pm

Add another condition, then System-> "Trigger once while true"

Anyways, maybe you are using the "Is overlaping another object" condition to check the collision between the ball and the enemy.

If that is the case, forget what I said about "Trigger once" and use "On collision with another object" instead of "overlaping" and it will only trigger once.
B
26
S
7
G
1
Posts: 74
Reputation: 2,092

Post » Wed Aug 06, 2014 12:55 pm

Momio wrote:Add another condition, then System-> "Trigger once while true"

Anyways, maybe you are using the "Is overlaping another object" condition to check the collision between the ball and the enemy.

If that is the case, forget what I said about "Trigger once" and use "On collision with another object" instead of "overlaping" and it will only trigger once.


I have used the "On Collision with another object" only, But Trigger once while true is not showing for me when trying to add another condition.

If I create a new condition, it is showing under special conditions.
B
7
S
1
Posts: 51
Reputation: 507

Post » Wed Aug 06, 2014 3:45 pm

may be you make, trigger once the main event/condition with no action while the on collission.... would now be a sub event under it
B
15
S
4
Posts: 138
Reputation: 2,003

Post » Wed Aug 06, 2014 4:43 pm

If I make the trigger once while true as a main condition with no action, on collision would not be a sub event.

@dasat I hope you understand what I am trying to say
B
7
S
1
Posts: 51
Reputation: 507

Post » Wed Aug 06, 2014 4:56 pm

As far as I know, any trigger condition (condition with the small green arrow) will only trigger once, every time it is triggered. That's why trigger once while true are not allowed in any trigger condition.

On to the problem:
Put a screenshot of your event (the one related to the trigger and animation) at least if you're not sharing your capx, people just can't really see what your problem is.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Wed Aug 06, 2014 5:13 pm

Just add an instance variable saying that the hit has occurred, and check that as part of your 'On collision' event.
ImageImageImage
B
71
S
22
G
257
Posts: 3,791
Reputation: 142,698

Post » Wed Aug 06, 2014 5:17 pm

I slightly changed the images. Anyways, @DuckfaceNinja here is that particular event screenshot. When the ball hits the target the animation starts. And as the ball hit again and again, the animation starts over and over.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 51
Reputation: 507

Post » Wed Aug 06, 2014 5:46 pm

animator wrote:as the ball hit again and again, the animation starts over and over.

@animator I see that is your problem but I don't quite get what you really want, so I assume you want the animation to stop at some point? I'm guessing the animation supposed to run only in 0.8 seconds? Then append a new action (stop animation) to stop it after wait 0.8 second action. Is the ball supposed to "hit again and again"?, if no then destroy the object (because I see you set the ball to break) or just add an action to slow it down until stop or something.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Wed Aug 06, 2014 5:56 pm

Just add a condition
target animation is not broke

should be fine..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests