Skip to content

Commit b53b47b

Browse files
committed
Add examples of behavior.
1 parent b025c5f commit b53b47b

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

docs/gdevelop5/behaviors/events-based-behaviors/index.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Behaviors are grouped into [extensions](/gdevelop5/extensions). They are the sam
3131

3232
Click on **Create or search for new extensions** at the bottom. Then, select **Create a new extension** to [create a new extension](/gdevelop5/extensions/create).
3333

34-
By default, extensions don't have any behavior. Add one by clicking on **Add a new behavior** on the left.
34+
By default, extensions don't have any behavior. Add one by clicking on the "+" button on the left next to **Behaviors**.
3535

36-
![](pasted/20210906-234614.png)
36+
![](/gdevelop5/events/functions/empty-extension.png)
3737

3838
You can choose the description and the name to display to users when they will add your behavior to an object. If you need to use a specific object (sprites, texts...), you can choose it with the drop-down list at the bottom.
3939

@@ -161,6 +161,18 @@ If you create a behavior and want to use this, just go to the properties of this
161161

162162
To use a behavior based on another, you don't need to do anything special! Just add it to your object as usual: any missing behavior will be added to your object, so you can start using it immediately.
163163

164+
## Write behaviors dedicated to your project
165+
166+
You probably used extensions from the community. These extensions aim to be usable in many projects, but extensions can also be created with only one project in mind.
167+
168+
The [platformer template](https://gdevelop.io/game-example/free/platformer) has a `Enemy` extension with a `MonsterEnemy` behavior. This behavior toggle between
169+
- a **Fire** state where it hurts the player
170+
- a **NoFire** state where the player can jump on it
171+
172+
![](platformer-enemy-extension.png)
173+
174+
The [Bomberman-like template](https://gdevelop.io/game-example/free/3d-bomber-bunny) shows how a game can be organized into extensions. The players, bombs and bonuses have their own custom behavior. It allows to gather the logic of each object in one place: their extension. The main events can then focus on how these objects interact with each other.
175+
164176
## A word about the advantages of behaviors
165177

166178
Creating your own behaviors has multiple advantages:
@@ -175,6 +187,11 @@ Creating your own behaviors has multiple advantages:
175187

176188
## Examples/ideas for custom behaviors
177189

190+
Installing and opening existing extensions can be a good way to see how behaviors work. The following extensions are simple enough not to feel lost when looking at their events:
191+
192+
- [Animated back and forth movement](https://wiki.gdevelop.io/gdevelop5/extensions/animated-back-and-forth-movement/)
193+
- [Flash object](https://wiki.gdevelop.io/gdevelop5/extensions/flash/)
194+
178195
You can imagine tons of different behaviors. Here are a few examples:
179196

180197
* A behavior to **manage the health of an enemy or a boss**.
93.9 KB
Loading

0 commit comments

Comments
 (0)