Skip to content

Commit ab20f9c

Browse files
authored
[ExplosionForce] [Update] Minor changes to description and logic (#703)
[ExplosionForce] [Update] Cleaned up description and added an object variable for angle of force
1 parent 8e41b4a commit ab20f9c

File tree

1 file changed

+48
-91
lines changed

1 file changed

+48
-91
lines changed
Lines changed: 48 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
{
22
"author": "Tristan Rhodes (https://victrisgames.itch.io/)",
33
"category": "Movement",
4-
"description": "Apply explosion-like physics forces to target objects that are inside the explosion radius. Forces push the target objects away from the explosion center. The force applied is stronger the closer the target object is to the explosion center. Target objects will be changed to \"Dynamic\" physics objects. \n\nRequirements:\n- Target Objects must have physics behavior\n- The action \"Pick all instances\" of Target Objects MUST be used directly above this action.\n\nObject Variables (Target Objects):\n- \"__ExplosionForce.Exploded\" (boolean)\n- \"__ExplosionForce.Magnitude\" (number)\n\nTips:\n- Start objects as \"Static\" physics objects so they won't move or fall over until the explosion automatically converts them to \"Dynamic\".\n- Use the \"__ExplosionForce.Exploded\" object variable to manage objects that were affected by an explosion. (For instance, start an opacity tween that fades away and deletes the objects.)\n- If your game freezes during an explosion, try using smaller radius or max force values.\n",
54
"extensionNamespace": "",
65
"fullName": "Explosion force",
76
"helpPath": "https://victrisgames.itch.io/extension-explosion-force",
87
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWJvbWIiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTEuMjUsNkEzLjI1LDMuMjUgMCAwLDEgMTQuNSwyLjc1QTMuMjUsMy4yNSAwIDAsMSAxNy43NSw2QzE3Ljc1LDYuNDIgMTguMDgsNi43NSAxOC41LDYuNzVDMTguOTIsNi43NSAxOS4yNSw2LjQyIDE5LjI1LDZWNS4yNUgyMC43NVY2QTIuMjUsMi4yNSAwIDAsMSAxOC41LDguMjVBMi4yNSwyLjI1IDAgMCwxIDE2LjI1LDZBMS43NSwxLjc1IDAgMCwwIDE0LjUsNC4yNUExLjc1LDEuNzUgMCAwLDAgMTIuNzUsNkgxNFY3LjI5QzE2Ljg5LDguMTUgMTksMTAuODMgMTksMTRBNyw3IDAgMCwxIDEyLDIxQTcsNyAwIDAsMSA1LDE0QzUsMTAuODMgNy4xMSw4LjE1IDEwLDcuMjlWNkgxMS4yNU0yMiw2SDI0VjdIMjJWNk0xOSw0VjJIMjBWNEgxOU0yMC45MSw0LjM4TDIyLjMzLDIuOTZMMjMuMDQsMy42N0wyMS42Miw1LjA5TDIwLjkxLDQuMzhaIiAvPjwvc3ZnPg==",
98
"name": "ExplosionForce",
109
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/bomb.svg",
1110
"shortDescription": "Simulate an explosion with physics forces on target objects.",
12-
"version": "1.3.0",
11+
"version": "1.3.1",
12+
"description": [
13+
"Apply explosion-like physics forces to target objects that are inside the explosion radius. Forces will push the target objects away from the explosion center. The force applied is stronger the closer the target object is to the explosion center. Target objects will be changed to \"Dynamic\" physics objects. ",
14+
"",
15+
"Requirements:",
16+
"",
17+
"- Target Objects must have physics behavior",
18+
"",
19+
"Tips:",
20+
"",
21+
"- Use the \"__ExplosionForce.Exploded\" object variable to detect when target objects are affected by an explosion. For instance, start an opacity tween that fades away and deletes the objects.",
22+
"",
23+
"Variables given to Target Objects:",
24+
"",
25+
"- \"__ExplosionForce.Exploded\" (boolean)",
26+
"- \"__ExplosionForce.Magnitude\" (number)",
27+
"- \"__ExplosionForce.Angle\" (number)",
28+
""
29+
],
30+
"origin": {
31+
"identifier": "ExplosionForce",
32+
"name": "gdevelop-extension-store"
33+
},
1334
"tags": [
1435
"explosion",
1536
"explode",
@@ -29,40 +50,31 @@
2950
"fullName": "Simulate explosion with physics forces",
3051
"functionType": "Action",
3152
"name": "ApplyExplosionForce",
32-
"private": false,
3353
"sentence": "Simulate an explosion that affects _PARAM1_ within explosion radius: _PARAM6_ (pixels), Explosion center: _PARAM3_, _PARAM4_. Max force: _PARAM5_",
3454
"events": [
3555
{
36-
"disabled": false,
37-
"folded": false,
3856
"type": "BuiltinCommonInstructions::ForEach",
3957
"object": "TargetObject",
4058
"conditions": [],
4159
"actions": [],
4260
"events": [
4361
{
44-
"disabled": false,
45-
"folded": false,
4662
"type": "BuiltinCommonInstructions::Standard",
4763
"conditions": [
4864
{
4965
"type": {
50-
"inverted": false,
5166
"value": "Egal"
5267
},
5368
"parameters": [
54-
"DistanceBetweenPositions(TargetObject.CenterX(),TargetObject.CenterY(),GetArgumentAsNumber(\"ExplosionCenterX\"),GetArgumentAsNumber(\"ExplosionCenterY\"))",
69+
"DistanceBetweenPositions(TargetObject.BoundingBoxCenterX(),TargetObject.BoundingBoxCenterY(),GetArgumentAsNumber(\"ExplosionCenterX\"),GetArgumentAsNumber(\"ExplosionCenterY\"))",
5570
"<",
5671
"GetArgumentAsNumber(\"ExplosionRadius\")"
57-
],
58-
"subInstructions": []
72+
]
5973
}
6074
],
6175
"actions": [],
6276
"events": [
6377
{
64-
"disabled": false,
65-
"folded": false,
6678
"type": "BuiltinCommonInstructions::Comment",
6779
"color": {
6880
"b": 109,
@@ -76,8 +88,6 @@
7688
"comment2": ""
7789
},
7890
{
79-
"disabled": false,
80-
"folded": false,
8191
"type": "BuiltinCommonInstructions::Standard",
8292
"conditions": [
8393
{
@@ -88,28 +98,22 @@
8898
"parameters": [
8999
"TargetObject",
90100
"Behavior"
91-
],
92-
"subInstructions": []
101+
]
93102
}
94103
],
95104
"actions": [
96105
{
97106
"type": {
98-
"inverted": false,
99107
"value": "Physics2::SetDynamic"
100108
},
101109
"parameters": [
102110
"TargetObject",
103111
"Behavior"
104-
],
105-
"subInstructions": []
112+
]
106113
}
107-
],
108-
"events": []
114+
]
109115
},
110116
{
111-
"disabled": false,
112-
"folded": false,
113117
"type": "BuiltinCommonInstructions::Comment",
114118
"color": {
115119
"b": 109,
@@ -119,46 +123,37 @@
119123
"textG": 0,
120124
"textR": 0
121125
},
122-
"comment": "Set an object variable that can be used to manage objects affected by the explosion (such as opacity tween and delete)",
126+
"comment": "Save object variables that can be used to manage objects affected by the explosion",
123127
"comment2": ""
124128
},
125129
{
126-
"disabled": false,
127-
"folded": false,
128130
"type": "BuiltinCommonInstructions::Standard",
129-
"conditions": [
131+
"conditions": [],
132+
"actions": [
130133
{
131134
"type": {
132-
"inverted": false,
133-
"value": "ObjectVariableAsBoolean"
135+
"value": "SetObjectVariableAsBoolean"
134136
},
135137
"parameters": [
136138
"TargetObject",
137139
"__ExplosionForce.Exploded",
138-
"False"
139-
],
140-
"subInstructions": []
141-
}
142-
],
143-
"actions": [
140+
"True"
141+
]
142+
},
144143
{
145144
"type": {
146-
"inverted": false,
147-
"value": "SetObjectVariableAsBoolean"
145+
"value": "ModVarObjet"
148146
},
149147
"parameters": [
150148
"TargetObject",
151-
"__ExplosionForce.Exploded",
152-
"True"
153-
],
154-
"subInstructions": []
149+
"__ExplosionForce.Angle",
150+
"=",
151+
"180 + TargetObject.AngleToPosition(GetArgumentAsNumber(\"ExplosionCenterX\"),GetArgumentAsNumber(\"ExplosionCenterY\"))"
152+
]
155153
}
156-
],
157-
"events": []
154+
]
158155
},
159156
{
160-
"disabled": false,
161-
"folded": false,
162157
"type": "BuiltinCommonInstructions::Comment",
163158
"color": {
164159
"b": 109,
@@ -172,30 +167,23 @@
172167
"comment2": ""
173168
},
174169
{
175-
"disabled": false,
176-
"folded": false,
177170
"type": "BuiltinCommonInstructions::Standard",
178171
"conditions": [],
179172
"actions": [
180173
{
181174
"type": {
182-
"inverted": false,
183175
"value": "ModVarObjet"
184176
},
185177
"parameters": [
186178
"TargetObject",
187179
"__ExplosionForce.Magnitude",
188180
"=",
189181
"(GetArgumentAsNumber(\"MaxForce\") * (GetArgumentAsNumber(\"ExplosionRadius\") - DistanceBetweenPositions(TargetObject.CenterX(),TargetObject.CenterY(),GetArgumentAsNumber(\"ExplosionCenterX\"),GetArgumentAsNumber(\"ExplosionCenterY\"))) / GetArgumentAsNumber(\"ExplosionRadius\"))"
190-
],
191-
"subInstructions": []
182+
]
192183
}
193-
],
194-
"events": []
184+
]
195185
},
196186
{
197-
"disabled": false,
198-
"folded": false,
199187
"type": "BuiltinCommonInstructions::Comment",
200188
"color": {
201189
"b": 109,
@@ -209,28 +197,23 @@
209197
"comment2": ""
210198
},
211199
{
212-
"disabled": false,
213-
"folded": false,
214200
"type": "BuiltinCommonInstructions::Standard",
215201
"conditions": [],
216202
"actions": [
217203
{
218204
"type": {
219-
"inverted": false,
220205
"value": "Physics2::ApplyPolarForce"
221206
},
222207
"parameters": [
223208
"TargetObject",
224209
"Behavior",
225-
"TargetObject.AngleToPosition(GetArgumentAsNumber(\"ExplosionCenterX\"),GetArgumentAsNumber(\"ExplosionCenterY\"))+180",
210+
"TargetObject.Variable(__ExplosionForce.Angle)",
226211
"TargetObject.Variable(__ExplosionForce.Magnitude)",
227212
"TargetObject.Behavior::MassCenterX()",
228213
"TargetObject.Behavior::MassCenterY()"
229-
],
230-
"subInstructions": []
214+
]
231215
}
232-
],
233-
"events": []
216+
]
234217
}
235218
]
236219
}
@@ -239,68 +222,42 @@
239222
],
240223
"parameters": [
241224
{
242-
"codeOnly": false,
243-
"defaultValue": "",
244225
"description": "Target Object",
245-
"longDescription": "",
246226
"name": "TargetObject",
247-
"optional": false,
248-
"supplementaryInformation": "",
249227
"type": "objectList"
250228
},
251229
{
252-
"codeOnly": false,
253-
"defaultValue": "",
254230
"description": "Physics Behavior (required)",
255-
"longDescription": "",
256231
"name": "Behavior",
257-
"optional": false,
258232
"supplementaryInformation": "Physics2::Physics2Behavior",
259233
"type": "behavior"
260234
},
261235
{
262-
"codeOnly": false,
263-
"defaultValue": "",
264236
"description": "Explosion center (X)",
265-
"longDescription": "",
266237
"name": "ExplosionCenterX",
267-
"optional": false,
268-
"supplementaryInformation": "",
269238
"type": "expression"
270239
},
271240
{
272-
"codeOnly": false,
273-
"defaultValue": "",
274241
"description": "Explosion center (Y)",
275-
"longDescription": "",
276242
"name": "ExplosionCenterY",
277-
"optional": false,
278-
"supplementaryInformation": "",
279243
"type": "expression"
280244
},
281245
{
282-
"codeOnly": false,
283-
"defaultValue": "",
284246
"description": "Max force (of explosion)",
285247
"longDescription": "Force decreases the farther an object is from the explosion center.",
286248
"name": "MaxForce",
287-
"optional": false,
288-
"supplementaryInformation": "",
289249
"type": "expression"
290250
},
291251
{
292-
"codeOnly": false,
293-
"defaultValue": "",
294252
"description": "Max distance (from center of explosion) (pixels)",
295253
"longDescription": "Objects less than this distance will be affected by the explosion.",
296254
"name": "ExplosionRadius",
297-
"optional": false,
298-
"supplementaryInformation": "",
299255
"type": "expression"
300256
}
301257
],
302258
"objectGroups": []
303259
}
304260
],
305-
"eventsBasedBehaviors": []
261+
"eventsBasedBehaviors": [],
262+
"eventsBasedObjects": []
306263
}

0 commit comments

Comments
 (0)