Ir para o conteúdo
Avatar do Ned, mascote do GNORGNOR

Why Does My Event Affect All Objects? How Events Work in Construct 3

You put several monsters on the screen and created an event to destroy a monster. When you tested it, they all disappeared at once. Or the opposite happened: you expected something to affect everyone, but only one object reacted. It’s not a bug. It’s the most important rule in the Construct 3 event sheet. Once…

Ned5 min read

Porque todos os monstros somem?

You put several monsters on the screen and created an event to destroy a monster. When you tested it, they all disappeared at once.

Or the opposite happened: you expected something to affect everyone, but only one object reacted.

It’s not a bug. It’s the most important rule in the Construct 3 event sheet. Once it makes sense, a lot of things in the engine stop seeming unpredictable.

In this article, we’ll understand this rule, test it in a quick experiment, and then deliberately cause the “error” to see exactly why it happens.

Haven’t opened Construct 3 yet? Start with [How to get started in Construct 3? Getting to know the engine before creating your first game — insert link].

First: “Monster” isn’t just one monster

Before we talk about events, we need to separate two ideas that seem the same but aren’t.

💡 Concept: object type and instance

Think of a cookie cutter. The cutter defines the shape. With it, you can make one cookie, ten, or a hundred. They all come out the same shape, but each cookie is a separate thing: one can be at the edge of the tray, another can break, and another can be eaten.

Construct 3 works in a similar way:

  • When you create a Sprite called Monster, you’re creating an object type (object type). It’s the “mold.”
  • Each copy of Monster placed in the layout is an instance. It’s each individual “cookie.”

All instances share what was defined in the object type, such as the image and behaviors. But each one has its own position, size, and state.

So when you write “Monster” in the event sheet, an important question comes up: which monsters? All of them? Just some? Just one?

The conditions answer that.

The rule: conditions choose, actions act on the ones chosen

A Construct 3 event doesn’t work like an order shouted at the entire object type (“Monsters, destroy yourselves!”). It works in two steps:

  1. The conditions check the instances and filter out the ones that meet the criteria.
  2. The actions are executed only on the instances that passed the filter.

Construct calls this process of choosing instances picking. You’ll come across this word a lot in forums and the documentation.

🧠 Think of it this way

A condition is a sieve. Every instance passes through it, and only the ones that meet the criteria are retained. The action affects only what made it through the sieve.

What if none of the event’s conditions mention Monster?

Then no one sifted through the monsters. In that case, an action on Monster applies to all instances.

That’s the answer to this article’s title.

🧪 Experiment: one click, one monster

Let’s see it in action. The experiment takes just a few minutes.

Setup:

1 – Create a new project.

    2 – Create a Sprite called Monster (any drawing will do, even a square).

    3 – Place several Monster instances in the layout, for example by copying and pasting. Five is enough.

    4 – Add the Mouse and Keyboard objects to the project. They don’t appear on screen, but Construct needs them to know what the player does with the mouse and keyboard.

      📝 The conditions and actions below are named as they appear in the editor in English. Construct 3 lets you change the interface language in Settings. If your editor is set to another language, the names may appear translated.

      Event 1:

      ConditionMouse → On object clicked → Monster
      ActionMonster → Destroy

      Run the project (preview) and click one of the monsters.

      Only the monster you clicked disappears. The others stay there.

      Why? The On object clicked condition checked all the monsters and picked only the instance that was clicked. The Destroy action only affected that instance.

      💥 Now let’s cause the “error”

      In the same event sheet, create a second event:

      Event 2:

      ConditionKeyboard → On key pressed → Space
      ActionMonster → Destroy

      Run the project and press the space bar.

      All the monsters disappear at once.

      Why? This condition checks the keyboard, not the monsters. No condition in this event selected Monster instances, so the action applies to all of them.

      Do you see what happened?

      The action is exactly the same in both events: Monster → Destroy. What changed was the condition. It decides who receives the action.

      What if there is more than one condition?

      An event can have several conditions, and all of them need to be true for the actions to run. When more than one condition refers to the same object, each one filters the result of the previous one a little further.

      Imagine an event that says, in plain language:

      “Clicked monster and with less than 5 hit points → destroy.”

      The first condition picks the clicked monster. The second checks whether that monster has low health. If it doesn’t, nothing happens.

      To build this event, each monster would need to store its own health, and that’s for the next step. For now, remember this idea: conditions in sequence narrow down the selection.

      ⚠️ Watch out: common mistakes

      • Using an action on an object that no condition mentioned. Result: the action affects every instance of that type.
      • Thinking the event “knows” which monster you had in mind. It doesn’t. It only knows what the conditions picked.
      • Combining Every tick with Destroy. Every tick is a System condition that runs all the time and doesn’t pick any monsters. An event Every tick → Monster Destroy deletes all the monsters as soon as the game starts, and it looks like they never existed.

      ✅ Checkpoint

      • An object type is the mold, and each instance is a copy in the layout.
      • Conditions pick instances (picking).
      • Actions act only on the picked instances.
      • If no condition in the event picked that object, the action applies to all instances.

      When something affects too many (or too few) objects, ask yourself:

      “Did any condition in this event pick this object?”

      🎯 GNOR Mission

      1. Build the experiment project with 5 monsters.
      2. Make clicking destroy only the monster you clicked.
      3. Make the space bar destroy all the monsters.
      4. Compare the two events and write down, in your own words, why the result was different.

      Extra challenge: can you make the space bar destroy only the monsters that are in the left half of the screen?
      Hint: look for a condition on Monster itself that compares the object’s position.

      🏁 What comes next

      Now we know that an event doesn’t talk to “the object,” but to the instances selected by the conditions. With that, we can control whether an action affects one monster, a few, or all of them.

      But a new problem comes up: what if each monster needs its own health, which goes down with each click instead of disappearing all at once?

      To do that, each instance needs to store its own information. That’s the topic of the next step: instance variables.

      A big hug!

      ned despedindo

      Newsletter

      Keep exploring with GNOR

      Sign-ups aren't live yet: sending will be connected soon.

      Written by

      Ned

      Conversa

      Comentários

      Carregando comentários…

      Deixe seu comentário

      Sem cadastro: só nome e e-mail. Seu e-mail não aparece no site e é usado apenas para identificar o comentário.

      Comentários passam por moderação antes de aparecer.

      Fundamentals

      What Is Game Design? The Fundamentals for Beginners Making Games

      When you think about making a game, your mind usually goes straight to the visible parts: characters, settings, the engine, interface buttons. But there’s one question that comes before all of that, and many people skip it: How will this game work? What’s the goal? What gets in the player’s way? What choices do they…

      1 min read

      Fundamentals

      Do You Need to Learn to Code to Make Games?

      You had an idea for a game. You started looking into how you could make it, and before long, words like programming, C#, JavaScript, variables, functions, and logic started coming up. Then you started wondering: “Do I need to learn to program to make games?” If you’ve never programmed before, this question can make game…

      1 min read