0 Favourites

Should I add a new event or add actions in same event?

  • Better new event or put everything for one event?

    It now works in two versions, but I do not know if it affects something negatively.

  • If you have more than one Enemies: Destroy action in your code under different events then it can simplify your code to use "On destroyed".

    Using "On destroyed" can also get around some problems with multiple enemies being destroyed in the same tick; if the "Add 1 to Killed" etc actions if are placed in the same event as the destroy action they would only be triggered once regardless of how many enemies were destroyed. Whereas "On destroyed" ensures that those actions trigger for each enemy.

  • If you have more than one Enemies: Destroy action in your code under different events then it can simplify your code to use "On destroyed".

    Using "On destroyed" can also get around some problems with multiple enemies being destroyed in the same tick; if the "Add 1 to Killed" etc actions if are placed in the same event as the destroy action they would only be triggered once regardless of how many enemies were destroyed. Whereas "On destroyed" ensures that those actions trigger for each enemy.

    @mekonbekon

    You said "On destroyed can also get around some problems"

    Ok So if in this case many enemies are killed in same tick, I should have "add 1 to killed" in "On destroyed" or not. Of course I want add 1 killed for each enemy.

  • Yes, if you want to add one per enemy it is best to have the "add 1 to killed" action on the "On destroyed" condition.

  • Burying a trigger that deep down in conditions for no apparent reason will bring you soon or later into problems. Because the trigger needs to discover the whole logic path up to the parent condition to find out if it is allowed to run its actions.

    Better change that 'On destroyed' event to a top level event.

  • 99Instances2Go

    Good point, I hadn't noticed that it was a sub-event.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Burying a trigger that deep down in conditions for no apparent reason will bring you soon or later into problems. Because the trigger needs to discover the whole logic path up to the parent condition to find out if it is allowed to run its actions.

    Better change that 'On destroyed' event to a top level event.

    @mekonbekon

    @99Instances2Go

    Ok, but then i must add rows from this previous event yes? And then it would be a new event.

    mean:

    + enemies < 0

    + system trigger once

    enemies on destroyed - Add 1 to kill

    Add 10 to PP

    Sad set to invisible

  • Yes, move the Enemies|On destroyed event and its associated actions to be a top-level event rather than a sub-event and you'll be fine.

  • Yes, move the Enemies|On destroyed event and its associated actions to be a top-level event rather than a sub-event and you'll be fine.

    @mekonbekon

    I tried make new event but I can't paste "trigger once" here.

  • You don't need to move those conditions. they should stay where they were before. You only need to move the on destroyed condition and its associated actions to be a main event.

  • You don't need to move those conditions. they should stay where they were before. You only need to move the on destroyed condition and its associated actions to be a main event.

    heh ok mekonbekon

    I don't understand because I think this event is under another and inherits everything. So as I move, I will not inherit those conditions (trigger once, live, type).

    There is many ways to move it:

    I'm not very smart at this hierarchy.

  • Are your enemies destroyed in any other event where lives are not <=0 or Type is not <=1? If not then it doesn't matter that the "on destroyed" event isn't nested and the other conditions aren't needed.

    If you have more than one type of enemy, or enemies are also destroyed in other events where their live value is greater than one then I'd use something like this:

    Enemies|On destroyed:

    Lives <=0:

    Type <=1: Do A

    Type =2: Do B

    Lives >0:

    Type <=1: Do C

    Type =2: Do D

    The "On Destroyed" condition would be a top level event. Exactly how you order the rest of the hierarchy is dependent upon the conditions you have set up for destroying the different enemies: you may want to switch it instead to have the Lives conditions nested under the Type conditions.

    What you definitely don't need is the "trigger once" condition with the "On Destroyed" condition, as "On Destroyed" will only trigger once per enemy that is destroyed anyhow.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
New Android Export Experiences
494 67,280
jabk's avatar
jabk
Unread hot topic
410 84,622
MrMegawatts's avatar
MrMegawatts
Unread hot topic
392 34,832
Joannesalfa's avatar
Joannesalfa