Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rectangle Movement] Update: Add option to select the position on the border (inside, center, outside) #956

Merged
merged 2 commits into from
Aug 6, 2023
Merged
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
284 changes: 242 additions & 42 deletions extensions/reviewed/RectangleMovement.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"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.",
"",
"It can be used for:",
"",
"- 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)).",
"",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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": []
}
]
}
Expand All @@ -501,6 +695,12 @@
"description": "Center object",
"name": "CenterObject",
"type": "objectList"
},
{
"description": "Position on border",
"name": "PositionOnBorder",
"supplementaryInformation": "[\"Inside\",\"Center\",\"Outside\"]",
"type": "stringWithSelector"
}
],
"objectGroups": []
Expand Down