Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gdevelop5:behaviors:events-based-behaviors [2019/06/25 00:04]
4ian [Use actions and conditions to manipulate the properties]
gdevelop5:behaviors:events-based-behaviors [2020/03/30 10:04] (current)
4ian
Line 1: Line 1:
-Event-based Behaviors: create your own custom ​behaviors+Custom behaviors: create your own behaviors ​with events
  
 Behaviors are very useful to quickly add some pre-determined features to objects. They are easy to use and allow to add complex features to your objects without having to re-create everything with events, which can be cumbersome and would make the events sheet cluttered (even if [[gdevelop5:​events:​group|groups]],​ [[gdevelop5:​events:​functions|functions]] and [[gdevelop5:​interface:​project-manager|external events]] can help). Behaviors are very useful to quickly add some pre-determined features to objects. They are easy to use and allow to add complex features to your objects without having to re-create everything with events, which can be cumbersome and would make the events sheet cluttered (even if [[gdevelop5:​events:​group|groups]],​ [[gdevelop5:​events:​functions|functions]] and [[gdevelop5:​interface:​project-manager|external events]] can help).
  
-In the latest version of GDevelop, you can now create your own **custom behaviors**. Like the usual, built-in behaviors, they can be attached to objects. They will then *interact with the object automatically*. They can **move the object**, change its **variables**,​ change the animations (for Sprite objects), change the text (for text objects) and more generally, do anything that you can usually do with events.+In GDevelop, you can now create your own **custom behaviors**. Like the usual, built-in behaviors, they can be attached to objects. They will then *interact with the object automatically*. They can **move the object**, change its **variables**,​ change the animations (for Sprite objects), change the text (for text objects) and more generally, do anything that you can usually do with events.
  
-<note tip>If you've not used [[gdevelop5:​events:functions|functions]], take a look  at them tooFunctions allow to create new actions ​and conditions. Behaviors are based on functions too.</​note>​+<note tip>If you want to see an example of how behaviors can be used in your game, read [[gdevelop5:​tutorials:how-to-make-behavior|How to make a behavior for an object]]. It's a step by step explanation ​and a good guide about architecturing your game with behaviors.</​note>​
  
 ## Create a new behavior ## Create a new behavior
Line 149: Line 149:
   * You can create a behavior that increases the "​Score"​ variable when the object is destroyed. You can then create items, collectibles or enemies that have this behavior, and when they are collected or killed, the score will automatically increase.   * You can create a behavior that increases the "​Score"​ variable when the object is destroyed. You can then create items, collectibles or enemies that have this behavior, and when they are collected or killed, the score will automatically increase.
  
 +<note tip>If you want to see an example of how behaviors can be used in your game, read [[gdevelop5:​tutorials:​how-to-make-behavior|How to make a behavior for an object]]. It's a step by step explanation and a good guide about architecturing your game with behaviors.</​note>​