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

0 favourites
  • 12 posts
From the Asset Store
In this game you will command the character by voice command.
  • 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

  • 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.

  • 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.

  • 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

  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just add an instance variable saying that the hit has occurred, and check that as part of your 'On collision' event.

  • 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.

  • 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.

  • Just add a condition

    target animation is not broke

    should be fine..

  • I used the wait action so that the user will watch the animation. Then I am calling the score layer to be visible. That is why I used the wait.

    And yes ball may hit again and again because it's a physics based game.

    Using a stop animation will not help either . Because if the ball hits the target before then the animation will start again.

  • Just add a condition

    target animation is not broke

    should be fine..

    LittleStain thanks. It works fine.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)