Skip to content

Commit 83974fd

Browse files
authored
[Reviewed] [Curved movement] Add a condition to check the number of loop (#947)
1 parent c7149fb commit 83974fd

File tree

1 file changed

+107
-26
lines changed

1 file changed

+107
-26
lines changed

extensions/reviewed/CurvedMovement.json

Lines changed: 107 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "CurvedMovement",
99
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Graphic Design/Graphic Design_bezier_curve.svg",
1010
"shortDescription": "Move objects on curved paths.",
11-
"version": "1.0.5",
11+
"version": "1.1.0",
1212
"description": [
1313
"This extension allows to move objects on Bézier curve paths.",
1414
"- Paths can be built dynamically or from predetermined paths in SVG format.",
@@ -5770,11 +5770,91 @@
57705770
"objectGroups": []
57715771
},
57725772
{
5773-
"description": "the length between the trajectory origin and the current position.",
5773+
"description": "the length between the trajectory origin and the current position without counting the loops.",
5774+
"fullName": "Position on the loop",
5775+
"functionType": "ExpressionAndCondition",
5776+
"name": "PositionOnLoop",
5777+
"sentence": "the length from the trajectory origin in the current loop",
5778+
"events": [
5779+
{
5780+
"type": "BuiltinCommonInstructions::Standard",
5781+
"conditions": [],
5782+
"actions": [
5783+
{
5784+
"type": {
5785+
"value": "SetReturnNumber"
5786+
},
5787+
"parameters": [
5788+
"mod(Object.Behavior::PropertyCurrentLength(), Object.Behavior::TotalLength())"
5789+
]
5790+
}
5791+
]
5792+
}
5793+
],
5794+
"expressionType": {
5795+
"type": "expression"
5796+
},
5797+
"parameters": [
5798+
{
5799+
"description": "Object",
5800+
"name": "Object",
5801+
"type": "object"
5802+
},
5803+
{
5804+
"description": "Behavior",
5805+
"name": "Behavior",
5806+
"supplementaryInformation": "CurvedMovement::SpeedPathMovement",
5807+
"type": "behavior"
5808+
}
5809+
],
5810+
"objectGroups": []
5811+
},
5812+
{
5813+
"description": "the number time the object loop the trajectory.",
5814+
"fullName": "Current loop",
5815+
"functionType": "ExpressionAndCondition",
5816+
"name": "Loop",
5817+
"sentence": "the current loop",
5818+
"events": [
5819+
{
5820+
"type": "BuiltinCommonInstructions::Standard",
5821+
"conditions": [],
5822+
"actions": [
5823+
{
5824+
"type": {
5825+
"value": "SetReturnNumber"
5826+
},
5827+
"parameters": [
5828+
"ceil(Object.Behavior::PropertyCurrentLength() / Object.Behavior::TotalLength())"
5829+
]
5830+
}
5831+
]
5832+
}
5833+
],
5834+
"expressionType": {
5835+
"type": "expression"
5836+
},
5837+
"parameters": [
5838+
{
5839+
"description": "Object",
5840+
"name": "Object",
5841+
"type": "object"
5842+
},
5843+
{
5844+
"description": "Behavior",
5845+
"name": "Behavior",
5846+
"supplementaryInformation": "CurvedMovement::SpeedPathMovement",
5847+
"type": "behavior"
5848+
}
5849+
],
5850+
"objectGroups": []
5851+
},
5852+
{
5853+
"description": "the length between the trajectory origin and the current position counting the loops.",
57745854
"fullName": "Position on the path",
57755855
"functionType": "ExpressionAndCondition",
57765856
"name": "PositionOnPath",
5777-
"sentence": "the length from the trajectory origin",
5857+
"sentence": "the length from the trajectory origin counting the loops",
57785858
"events": [
57795859
{
57805860
"type": "BuiltinCommonInstructions::Standard",
@@ -5867,7 +5947,7 @@
58675947
"Object",
58685948
"Behavior",
58695949
"=",
5870-
"mod(GetArgumentAsNumber(\"Value\"), Object.Behavior::TotalLength())"
5950+
"GetArgumentAsNumber(\"Value\")"
58715951
]
58725952
}
58735953
]
@@ -6004,6 +6084,7 @@
60046084
"fullName": "Current length",
60056085
"functionType": "Condition",
60066086
"name": "CheckPositionOnPath",
6087+
"private": true,
60076088
"sentence": "_PARAM0_ is less than _PARAM2_ pixels away from the trajectory origin",
60086089
"events": [
60096090
{
@@ -6014,7 +6095,7 @@
60146095
"value": "BuiltinCommonInstructions::CompareNumbers"
60156096
},
60166097
"parameters": [
6017-
"Object.Behavior::PositionOnPath()",
6098+
"Object.Behavior::PositionOnLoop()",
60186099
"<",
60196100
"GetArgumentAsNumber(\"Length\")"
60206101
]
@@ -6318,14 +6399,14 @@
63186399
"subInstructions": [
63196400
{
63206401
"type": {
6321-
"value": "CurvedMovement::SpeedPathMovement::PropertySpeed"
6322-
},
6323-
"parameters": [
6324-
"Object",
6325-
"Behavior",
6326-
">",
6327-
"0"
6328-
]
6402+
"value": "CurvedMovement::SpeedPathMovement::PropertySpeed"
6403+
},
6404+
"parameters": [
6405+
"Object",
6406+
"Behavior",
6407+
">",
6408+
"0"
6409+
]
63296410
},
63306411
{
63316412
"type": {
@@ -6367,14 +6448,14 @@
63676448
"subInstructions": [
63686449
{
63696450
"type": {
6370-
"value": "CurvedMovement::SpeedPathMovement::PropertySpeed"
6371-
},
6372-
"parameters": [
6373-
"Object",
6374-
"Behavior",
6375-
"<",
6376-
"0"
6377-
]
6451+
"value": "CurvedMovement::SpeedPathMovement::PropertySpeed"
6452+
},
6453+
"parameters": [
6454+
"Object",
6455+
"Behavior",
6456+
"<",
6457+
"0"
6458+
]
63786459
},
63796460
{
63806461
"type": {
@@ -6386,13 +6467,13 @@
63866467
"<",
63876468
"0"
63886469
]
6470+
}
6471+
]
63896472
}
63906473
]
63916474
}
63926475
]
63936476
}
6394-
]
6395-
}
63966477
],
63976478
"actions": [
63986479
{
@@ -7089,7 +7170,7 @@
70897170
"value": "SetReturnNumber"
70907171
},
70917172
"parameters": [
7092-
"mod(Object.Behavior::PropertyCurrentLength(), Object.Behavior::PathLength())"
7173+
"mod(Object.Behavior::PositionOnLoop(), Object.Behavior::PathLength())"
70937174
]
70947175
}
70957176
]
@@ -7179,7 +7260,7 @@
71797260
"value": "SetReturnNumber"
71807261
},
71817262
"parameters": [
7182-
"floor(Object.Behavior::PropertyCurrentLength() / Object.Behavior::PathLength())"
7263+
"floor(Object.Behavior::PositionOnLoop() / Object.Behavior::PathLength())"
71837264
]
71847265
}
71857266
]
@@ -7257,7 +7338,7 @@
72577338
"value": "SetReturnNumber"
72587339
},
72597340
"parameters": [
7260-
"mod(Object.Behavior::PropertyCurrentLength(), Object.Behavior::TotalLength())"
7341+
"mod(Object.Behavior::PositionOnLoop(), Object.Behavior::TotalLength())"
72617342
]
72627343
}
72637344
]

0 commit comments

Comments
 (0)