diff --git a/automated_updates_data.json b/automated_updates_data.json index c6d8df7148..c7a4ed5b51 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -1,5 +1,5 @@ { - "last_automated_updates_commit": "ec5dc8937205cd8e1b9bdedb434a19da1b822613", + "last_automated_updates_commit": "cf3545cfcbc132b2895f92df9e9e23baaa729ad3", "last_improved_things": [ { "date": "2026-02-16", diff --git a/docs/gdevelop5/behaviors/anchor/index.md b/docs/gdevelop5/behaviors/anchor/index.md index bf00d25151..fdf017f7f2 100644 --- a/docs/gdevelop5/behaviors/anchor/index.md +++ b/docs/gdevelop5/behaviors/anchor/index.md @@ -18,18 +18,16 @@ To add an anchor to an object: ![](anchorbehavior.png) +The behavior editor shows simplified buttons for common anchoring patterns for both **horizontal** and **vertical** axes: -## Behavior parameters + * **None**: No anchor applied. + * **Left / Top**: Object stays pinned to the left or top edge. + * **Center**: Object stays centered horizontally or vertically. + * **Right / Bottom**: Object stays pinned to the right or bottom edge. + * **Fill**: Object stretches to fill the window from one edge to the other. + * **Fill proportionally**: Object edges scale proportionally with the window size. -### Edge anchor -You can choose to what the object will be anchored from several options: - - * **None**: No anchor will be applied to the selected edge. - * **Window side**: The distance between the object's edge and the selected window side is set so that it is the same for any window size. - * **Window center**: The distance between the object's edge and the center of the window is maintained. - * **Proportional**: The object's edge will always be set so that it is at the same proportion of the screen. - -Note that setting anchors to opposite edges will stretch the object. +Advanced per-edge options (left, right, top, bottom edges individually) are available in the collapsible **Advanced** section of the behavior editor. ## Reference diff --git a/docs/gdevelop5/events/foreach/index.md b/docs/gdevelop5/events/foreach/index.md index 7328a762af..fc5ff480f7 100644 --- a/docs/gdevelop5/events/foreach/index.md +++ b/docs/gdevelop5/events/foreach/index.md @@ -13,6 +13,19 @@ A "For Each" event is a special [event](/gdevelop5/events) that takes an object For Each events support [local variables](/gdevelop5/all-features/variables/local-variables). Local variables declared in a For Each event are scoped to the loop: they are initialized before the loop starts and are only accessible within the loop and its sub-events. +## Ordering instances + +By default, a For Each event processes instances in an unspecified order. You can change this by selecting **ordered by** in the event header and entering an expression. The expression is evaluated for each instance, and instances are then processed in ascending or descending order based on the result. + +Common uses include: +- Processing enemies from closest to farthest: `Enemy.Distance(Player)` +- Processing objects by a variable: `MyObject.Variable(Priority)` +- Processing objects by a behavior value, such as health or speed + +You can also set a **limit** to process only the first N instances after sorting. For example, sorting enemies by distance and limiting to 3 will run the event only for the 3 closest enemies. + +To add or remove ordering, right-click on the For Each event and choose **Add Ordering** or **Remove Ordering**. + ## Loop counter variable For Each events can have a **loop counter variable**. When set, this variable starts at 0 and is automatically incremented by 1 for each object instance processed. This is useful to know the index of the current object in the iteration.