From 4f83256664b9da63edaba40b7a1de6da38419174 Mon Sep 17 00:00:00 2001 From: Tristan Rhodes Date: Sat, 5 Aug 2023 17:00:13 -0600 Subject: [PATCH 1/2] Added option to select the position on the border (inside, center, outside) --- extensions/reviewed/RectangleMovement.json | 284 ++++++++++++++++++--- 1 file changed, 242 insertions(+), 42 deletions(-) diff --git a/extensions/reviewed/RectangleMovement.json b/extensions/reviewed/RectangleMovement.json index b6c1f770b..f1c3291f9 100644 --- a/extensions/reviewed/RectangleMovement.json +++ b/extensions/reviewed/RectangleMovement.json @@ -8,7 +8,7 @@ "name": "RectangleMovement", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/shape-rectangle-plus.svg", "shortDescription": "Move objects in a rectangular pattern.", - "version": "1.1.1", + "version": "1.2.0", "description": [ "Move objects in a rectangular pattern with easing functions from the Tween extension.", "", @@ -16,7 +16,7 @@ "", "- Moveable platforms", "- Enemy movement patterns", - "- Moving along the border of another object", + "- Moving along the border of another object (inside, center, outside)", "", "The platformer example uses this extension ([open the project online](https://editor.gdevelop.io/?project=example://platformer)).", "", @@ -217,7 +217,7 @@ "fullName": "Update rectangular movement to follow the border of an object", "functionType": "Action", "name": "MoveAlongBorderOfObject", - "sentence": "Update rectangular movement of _PARAM1_ to follow the border of _PARAM3_", + "sentence": "Update rectangular movement of _PARAM1_ to follow the border of _PARAM3_. Position on border: _PARAM4_", "events": [ { "colorB": 228, @@ -432,50 +432,244 @@ ] } ], - "actions": [ - { - "type": { - "value": "RectangleMovement::RectangleMovement::SetTop" - }, - "parameters": [ - "MovingObject", - "RectangleMovement", - "CenterObject.BoundingBoxTop()", - "" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "RectangleMovement::RectangleMovement::SetBottom" - }, - "parameters": [ - "MovingObject", - "RectangleMovement", - "CenterObject.BoundingBoxBottom()", - "" - ] + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Inside (default)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "CompareArgumentAsString" + }, + "parameters": [ + "\"PositionOnBorder\"", + "=", + "\"Inside\"" + ] + }, + { + "type": { + "value": "CompareArgumentAsString" + }, + "parameters": [ + "\"PositionOnBorder\"", + "=", + "\"\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetTop" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxTop()", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetBottom" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxBottom() - MovingObject.Height()", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetLeft" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxLeft()", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetRight" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxRight() - MovingObject.Width()", + "" + ] + } + ] + } + ], + "parameters": [] }, { - "type": { - "value": "RectangleMovement::RectangleMovement::SetLeft" - }, - "parameters": [ - "MovingObject", - "RectangleMovement", - "CenterObject.BoundingBoxLeft()", - "" - ] + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Center", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareArgumentAsString" + }, + "parameters": [ + "\"PositionOnBorder\"", + "=", + "\"Center\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetTop" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxTop() - MovingObject.Height()/2", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetBottom" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxBottom() - MovingObject.Height()/2", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetLeft" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxLeft() - MovingObject.Width()/2", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetRight" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxRight() - MovingObject.Width()/2", + "" + ] + } + ] + } + ], + "parameters": [] }, { - "type": { - "value": "RectangleMovement::RectangleMovement::SetRight" - }, - "parameters": [ - "MovingObject", - "RectangleMovement", - "CenterObject.BoundingBoxRight()", - "" - ] + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Outside", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareArgumentAsString" + }, + "parameters": [ + "\"PositionOnBorder\"", + "=", + "\"Outside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetTop" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxTop() - MovingObject.Height()", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetBottom" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxBottom()", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetLeft" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxLeft() - MovingObject.Width()", + "" + ] + }, + { + "type": { + "value": "RectangleMovement::RectangleMovement::SetRight" + }, + "parameters": [ + "MovingObject", + "RectangleMovement", + "CenterObject.BoundingBoxRight()", + "" + ] + } + ] + } + ], + "parameters": [] } ] } @@ -501,6 +695,12 @@ "description": "Center object", "name": "CenterObject", "type": "objectList" + }, + { + "description": "", + "name": "PositionOnBorder", + "supplementaryInformation": "[\"Inside\",\"Center\",\"Outside\"]", + "type": "stringWithSelector" } ], "objectGroups": [] From ddb33083b8ca0df0d5943f1f8350941be654bed3 Mon Sep 17 00:00:00 2001 From: Tristan Rhodes Date: Sat, 5 Aug 2023 21:27:09 -0600 Subject: [PATCH 2/2] Added description --- extensions/reviewed/RectangleMovement.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/reviewed/RectangleMovement.json b/extensions/reviewed/RectangleMovement.json index f1c3291f9..b2c7de738 100644 --- a/extensions/reviewed/RectangleMovement.json +++ b/extensions/reviewed/RectangleMovement.json @@ -697,7 +697,7 @@ "type": "objectList" }, { - "description": "", + "description": "Position on border", "name": "PositionOnBorder", "supplementaryInformation": "[\"Inside\",\"Center\",\"Outside\"]", "type": "stringWithSelector"