Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docs/gdevelop5/behaviors/events-based-behaviors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Behaviors from community extensions are chosen for their ability to be useful in

Behaviors are grouped into [extensions](/gdevelop5/extensions). They are the same as [the extensions that can be installed](/gdevelop5/extensions/search). Extensions of a project are listed in the [Project Manager](/gdevelop5/interface/project-manager).

![](/gdevelop5/extensions/create/pasted/20230305-115305.png)
![](/gdevelop5/extensions/create-search-extension.png){ width="447" }

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).
Click on the **+** button at the top-right of the **Extensions** section. Then, select **Create a new extension** to [create a new extension](/gdevelop5/extensions/create).

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

Expand All @@ -45,11 +45,11 @@ Behaviors can also embed properties, which are number, strings or booleans that

Click on the behavior in the list to see the list of functions composing the behavior. It will appear on the right side panel.

![](pasted/20210906-235104.png)
![](add-behavior-function.png){ width="555" }

By default, a behavior is empty and does nothing. To add interactivity, you can add a new function. You'll be given the choice between some predefined functions, called *lifecycle methods*, or a custom function. Lifecycle methods will be called by the game engine automatically at some key moment during the game. Custom functions will be available to extension users as conditions, actions or expressions (like [usual functions outside behaviors](/gdevelop5/events/functions)).

![](pasted/20210906-235126.png)
![](behavior-function-types.png){ width="595" }

### Run events at object creations

Expand Down Expand Up @@ -149,7 +149,7 @@ Properties won't be usable from outside of the behavior. Properties are said to

![](generate-property-accessors.png)

## Behaviors using other behaviors as properties
## Rely on other behaviors

It is possible for behaviors to use other "required behaviors" as properties. When this is the case, GDevelop will ensure that any object using your behavior will also use the other one.
You can then use the behavior entered as a property inside the actions, conditions, expressions and the lifecycle functions of your own behavior.
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docs/gdevelop5/events/functions/add-function.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/gdevelop5/events/functions/empty-extension.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
27 changes: 14 additions & 13 deletions docs/gdevelop5/events/functions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,27 @@ Similarly to scenes or [external events](/gdevelop5/interface), functions are wr

Functions are grouped into [extensions](/gdevelop5/extensions). They are the same as [the extensions that can be installed](/gdevelop5/extensions/search). Extensions of a project are listed in the [Project Manager](/gdevelop5/interface/project-manager).

![](/gdevelop5/extensions/create/pasted/20230305-115305.png)
![](/gdevelop5/extensions/create-search-extension.png){ width="447" }

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).
Click on the **+** button at the top-right of the **Extensions** section. Then, select **Create a new extension** to [create a new extension](/gdevelop5/extensions/create).

By default, extensions don't have any function. Add one by clicking on the "+" button on the left next to **Functions**.

![](empty-extension.png)

### Organize functions with folders

When an extension has many functions, you can group them into **folders** to keep the list tidy. Right-click in the functions list and choose **Add a folder**, then drag functions into it. Folder names cannot contain `/`.
![](add-function.png)

A new function is added, it's time to give it a name. By convention:

- actions start with a verb for instance `Jump`
- conditions start with `Is` for instance `IsJumping`
- expressions don't have any verb for instance `JumpSpeed`

![](empty-function.png)

### Organize functions with folders

When an extension has many functions, you can group them into **folders** to keep the list tidy. Right-click in the functions list and choose **Add a folder**, then drag functions into it. Folder names cannot contain `/`.


## Describe a function

Selecting a function displays its events and the **function configuration** panel on the top with a few fields:
Expand All @@ -51,7 +54,7 @@ Selecting a function displays its events and the **function configuration** pane

Parameters can be inserted in a sentence by writing `_PARAMx_` between underscores where `x` must be replaced by the parameter number (starting from 1).

![](pasted/20221118-093605.png)
![](function-description.png)

## Add parameters

Expand All @@ -63,8 +66,6 @@ They can be added from the **Parameter** tab. Each of them requires:
* **Type** - either object, number or text (see the [list of all types](/gdevelop5/events/functions/#references-of-parameters)).
* **Label** - shown to extension users when filling the parameter values.

![](pasted/20221118-093700.png)

## Write function events

Events can be added to functions. These events are executed when the function is used in other event sheets. Which means through its condition, action or expression depending of the function type.
Expand All @@ -77,7 +78,7 @@ Only the objects from the function parameters can be used in a function. Scene o

When **Any object** is selected for the **object type**, the object can be used with a limited set of actions and conditions. Choosing a specific object type gives additional actions and conditions.

![](pasted/20221118-093830.png)
![](function-using-objects.png)

Conditions and actions from behaviors can also be used in functions events. For this, behavior parameters must be added after an object parameter.

Expand All @@ -97,7 +98,7 @@ Parameters can also be used directly in expressions by writing their name. For i

Here is an example of a text parameter that will get a scene name, which is then used in an action for changing the scene.

![](function_text_expression.png)
![](function-using-string.png)

!!! note

Expand Down Expand Up @@ -125,7 +126,7 @@ Variables can be useful within functions for intermediary results or to keep a s

Extension functions can be found in conditions and actions lists like any other feature of the engine.

![](pasted/20221118-094110.png)
![](function-usage.png)

## Write functions dedicated to your project

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file modified docs/gdevelop5/events/functions/platformer-player-extension.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
6 changes: 3 additions & 3 deletions docs/gdevelop5/extensions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Developers can also [contribute to extensions built directly inside GDevelop](ht

## Create a new extension

Open the project manager, then click on **Create or search for new extensions**:
Open the project manager, then click on the **+** button at the top-right of the **Extensions** section:

![](create/pasted/20230305-115305.png)
![](create-search-extension.png){ width="447" }

A new window opened up, at the bottom click **Create a new extension**:

![](create/pasted/20230305-115341.png)
![](extension-store.png)

A new extension is added to the project manager. It's recommended to immediately change the name to something that will hint at what the extension is providing by a right click on the extension and choose **Rename**.

Expand Down
Diff not rendered.
Diff not rendered.
Binary file added docs/gdevelop5/extensions/extension-store.png
Binary file removed docs/gdevelop5/extensions/grid_movement.gif
Diff not rendered.
4 changes: 2 additions & 2 deletions docs/gdevelop5/extensions/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ title: Install new extensions

You can browse the [list of GDevelop extensions here](/gdevelop5/extensions).

Finding **new behaviors, conditions, actions or expressions** for your game in GDevelop is easy. In the [Project Manager](/gdevelop5/interface/project-manager), click on *Create or search for new extensions*:
Finding **new behaviors, conditions, actions or expressions** for your game in GDevelop is easy. In the [Project Manager](/gdevelop5/interface/project-manager), click on the **+** button at the top-right of the **Extensions** section:

![](/gdevelop5/extensions/search/pasted/20230305-114603.png)
![](/gdevelop5/extensions/create-search-extension.png){ width="447" }

All the extensions from the GDevelop ecosystem will be shown:

Expand Down
Diff not rendered.
Loading