Construct 3 r405

You're viewing a single comment in a conversation. View all the comments
  • 6 Comments

  • Order by
  • What is it used for and how do you use it?

    • Signals will allow you to make your own event triggers. You can simply understand it as: let someone do something when they receive a message. It provides you with another way to organize your code. When receiving a signal, you don't need to pick them first. You just tell them to run action when they get a message.

      For example, when the enemy's health is less than or equal to 0, let the enemy send a "dead" signal.Then write in another place that when the enemy receives the "dead" signal, run the action, function or object action.

      Moreover, the signal is composed of strings, which is very flexible. You can do more with it

    • Basically you decouple the event sender from the event receiver.

      So instead of using this line:

      On Player Created -> Call Enemy Jump Action

      You instead do:

      On Player Created -> Send Signal named "PlayerCreated"

      On Signal "PlayerCreated" -> Call Enemy Jump Action

      This is useful because now the player doesn't care about the enemy and vice versa. Each one of them can use its own event sheet and logic. Unlike the first example, which if you delete Enemy, or move the Player code to a project that doesn't have Enemy, the code will break (because Player and Enemy are dependent on each other).

      The event-based game architecture is well-known in the industry, and you will find lots of videos about it.