|
9 | 9 | "name": "TopDownMovementAnimator", |
10 | 10 | "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Glyphster Pack/Master/SVG/Arrows/a6026156355ae5f03613b03971e4ddb50d0c95b8901e7a21edc57f33f0032e42_Arrows_thin_arrows_all_directions_cross.svg", |
11 | 11 | "shortDescription": "Change the animation according to the movement direction.", |
12 | | - "version": "0.2.2", |
| 12 | + "version": "0.2.3", |
13 | 13 | "description": "Change the animation according to the movement direction.", |
14 | 14 | "origin": { |
15 | 15 | "identifier": "TopDownMovementAnimator", |
|
229 | 229 | "events": [ |
230 | 230 | { |
231 | 231 | "type": "BuiltinCommonInstructions::Standard", |
232 | | - "conditions": [ |
233 | | - { |
234 | | - "type": { |
235 | | - "value": "BooleanVariable" |
236 | | - }, |
237 | | - "parameters": [ |
238 | | - "IsPausingAnimation", |
239 | | - "True", |
240 | | - "" |
241 | | - ] |
242 | | - } |
243 | | - ], |
| 232 | + "conditions": [], |
244 | 233 | "actions": [ |
245 | 234 | { |
246 | 235 | "type": { |
247 | | - "value": "TopDownMovementAnimator::TopDownMovementAnimator::SetAnimationPause" |
| 236 | + "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationDirection" |
248 | 237 | }, |
249 | 238 | "parameters": [ |
250 | 239 | "Object", |
251 | 240 | "Behavior", |
| 241 | + "NewAnimationDirection", |
252 | 242 | "" |
253 | 243 | ] |
254 | 244 | } |
|
271 | 261 | "actions": [ |
272 | 262 | { |
273 | 263 | "type": { |
274 | | - "value": "TopDownMovementAnimator::TopDownMovementAnimator::SetAnimationSpeedScale" |
| 264 | + "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationSpeedScale" |
275 | 265 | }, |
276 | 266 | "parameters": [ |
277 | 267 | "Object", |
|
283 | 273 | }, |
284 | 274 | { |
285 | 275 | "type": "BuiltinCommonInstructions::Standard", |
286 | | - "conditions": [], |
287 | | - "actions": [ |
| 276 | + "conditions": [ |
288 | 277 | { |
289 | 278 | "type": { |
290 | | - "value": "SetNumberVariable" |
| 279 | + "value": "BooleanVariable" |
291 | 280 | }, |
292 | 281 | "parameters": [ |
293 | | - "NewAnimationDirection", |
294 | | - "=", |
295 | | - "Object.Behavior::Direction()" |
| 282 | + "IsPausingAnimation", |
| 283 | + "True", |
| 284 | + "" |
296 | 285 | ] |
297 | 286 | } |
298 | 287 | ], |
299 | | - "events": [ |
| 288 | + "actions": [ |
300 | 289 | { |
301 | | - "type": "BuiltinCommonInstructions::Comment", |
302 | | - "color": { |
303 | | - "b": 109, |
304 | | - "g": 230, |
305 | | - "r": 255, |
306 | | - "textB": 0, |
307 | | - "textG": 0, |
308 | | - "textR": 0 |
| 290 | + "type": { |
| 291 | + "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationPause" |
309 | 292 | }, |
310 | | - "comment": "Use a small margin is used to avoid to flicker between 2 directions." |
311 | | - }, |
312 | | - { |
313 | | - "type": "BuiltinCommonInstructions::Standard", |
314 | | - "conditions": [ |
315 | | - { |
316 | | - "type": { |
317 | | - "value": "BuiltinCommonInstructions::CompareNumbers" |
318 | | - }, |
319 | | - "parameters": [ |
320 | | - "abs(Object.Behavior::DirectionDifference(NewAnimationDirection, AnimationDirection))", |
321 | | - ">", |
322 | | - "0.5 + 0.03125" |
323 | | - ] |
324 | | - } |
325 | | - ], |
326 | | - "actions": [ |
327 | | - { |
328 | | - "type": { |
329 | | - "value": "TopDownMovementAnimator::TopDownMovementAnimator::SetAnimationDirection" |
330 | | - }, |
331 | | - "parameters": [ |
332 | | - "Object", |
333 | | - "Behavior", |
334 | | - "NewAnimationDirection", |
335 | | - "" |
336 | | - ] |
337 | | - } |
| 293 | + "parameters": [ |
| 294 | + "Object", |
| 295 | + "Behavior", |
| 296 | + "" |
338 | 297 | ] |
339 | 298 | } |
340 | | - ], |
341 | | - "variables": [ |
342 | | - { |
343 | | - "folded": true, |
344 | | - "name": "NewAnimationDirection", |
345 | | - "type": "number", |
346 | | - "value": 0 |
347 | | - } |
348 | 299 | ] |
349 | 300 | } |
350 | 301 | ], |
|
410 | 361 | "name": "SetAnimationName", |
411 | 362 | "sentence": "", |
412 | 363 | "events": [ |
| 364 | + { |
| 365 | + "type": "BuiltinCommonInstructions::Comment", |
| 366 | + "color": { |
| 367 | + "b": 109, |
| 368 | + "g": 230, |
| 369 | + "r": 255, |
| 370 | + "textB": 0, |
| 371 | + "textG": 0, |
| 372 | + "textR": 0 |
| 373 | + }, |
| 374 | + "comment": "Also update the animation direction to avoid to play the animation in an old direction for 1 frame." |
| 375 | + }, |
413 | 376 | { |
414 | 377 | "type": "BuiltinCommonInstructions::Standard", |
415 | 378 | "conditions": [ |
|
444 | 407 | "Behavior", |
445 | 408 | "" |
446 | 409 | ] |
| 410 | + }, |
| 411 | + { |
| 412 | + "type": { |
| 413 | + "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationDirection" |
| 414 | + }, |
| 415 | + "parameters": [ |
| 416 | + "Object", |
| 417 | + "Behavior", |
| 418 | + "NewAnimationDirection", |
| 419 | + "" |
| 420 | + ] |
447 | 421 | } |
448 | 422 | ] |
449 | 423 | } |
|
581 | 555 | }, |
582 | 556 | { |
583 | 557 | "type": { |
584 | | - "value": "TopDownMovementAnimator::TopDownMovementAnimator::SetAnimationPause" |
| 558 | + "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationPause" |
585 | 559 | }, |
586 | 560 | "parameters": [ |
587 | 561 | "Object", |
|
735 | 709 | }, |
736 | 710 | { |
737 | 711 | "type": { |
738 | | - "value": "TopDownMovementAnimator::TopDownMovementAnimator::SetAnimationSpeedScale" |
| 712 | + "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationSpeedScale" |
739 | 713 | }, |
740 | 714 | "parameters": [ |
741 | 715 | "Object", |
|
772 | 746 | "description": "Change the animation speed scale according to the object speed.", |
773 | 747 | "fullName": "Animation speed scale", |
774 | 748 | "functionType": "Action", |
775 | | - "name": "SetAnimationSpeedScale", |
| 749 | + "name": "UpdateAnimationSpeedScale", |
776 | 750 | "private": true, |
777 | 751 | "sentence": "Change the animation speed scale according to _PARAM0_ speed", |
778 | 752 | "events": [ |
|
854 | 828 | "description": "Pause the animation according to the object speed.", |
855 | 829 | "fullName": "Animation pause", |
856 | 830 | "functionType": "Action", |
857 | | - "name": "SetAnimationPause", |
| 831 | + "name": "UpdateAnimationPause", |
858 | 832 | "private": true, |
859 | 833 | "sentence": "Pause the animation according to _PARAM0_ speed", |
860 | 834 | "events": [ |
|
1021 | 995 | "objectGroups": [] |
1022 | 996 | }, |
1023 | 997 | { |
1024 | | - "description": "Change the animation direction of the object.", |
1025 | | - "fullName": "Animation name and direction", |
| 998 | + "description": "Update the animation direction of the object.", |
| 999 | + "fullName": "Update animation direction", |
1026 | 1000 | "functionType": "Action", |
1027 | | - "name": "SetAnimationDirection", |
| 1001 | + "name": "UpdateAnimationDirection", |
1028 | 1002 | "private": true, |
1029 | | - "sentence": "Change the animation direction of _PARAM0_ to _PARAM2_", |
| 1003 | + "sentence": "Update the animation direction of _PARAM0_", |
1030 | 1004 | "events": [ |
1031 | 1005 | { |
1032 | 1006 | "type": "BuiltinCommonInstructions::Comment", |
|
1049 | 1023 | "value": "SetNumberVariable" |
1050 | 1024 | }, |
1051 | 1025 | "parameters": [ |
1052 | | - "AnimationDirection", |
1053 | | - "=", |
1054 | | - "mod(mod(round(NewDirection), DirectionCount) + DirectionCount, DirectionCount)" |
1055 | | - ] |
1056 | | - }, |
1057 | | - { |
1058 | | - "type": { |
1059 | | - "value": "SetNumberVariable" |
1060 | | - }, |
1061 | | - "parameters": [ |
1062 | | - "AnimationElapsedTime", |
| 1026 | + "NewAnimationDirection", |
1063 | 1027 | "=", |
1064 | | - "Object.Animation::ElapsedTime()" |
| 1028 | + "Object.Behavior::Direction()" |
1065 | 1029 | ] |
1066 | | - }, |
| 1030 | + } |
| 1031 | + ], |
| 1032 | + "events": [ |
1067 | 1033 | { |
1068 | | - "type": { |
1069 | | - "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationName" |
| 1034 | + "type": "BuiltinCommonInstructions::Comment", |
| 1035 | + "color": { |
| 1036 | + "b": 109, |
| 1037 | + "g": 230, |
| 1038 | + "r": 255, |
| 1039 | + "textB": 0, |
| 1040 | + "textG": 0, |
| 1041 | + "textR": 0 |
1070 | 1042 | }, |
1071 | | - "parameters": [ |
1072 | | - "Object", |
1073 | | - "Behavior", |
1074 | | - "" |
1075 | | - ] |
| 1043 | + "comment": "Use a small margin is used to avoid to flicker between 2 directions." |
1076 | 1044 | }, |
1077 | 1045 | { |
1078 | | - "type": { |
1079 | | - "value": "AnimatableCapability::AnimatableBehavior::SetElapsedTime" |
1080 | | - }, |
1081 | | - "parameters": [ |
1082 | | - "Object", |
1083 | | - "Animation", |
1084 | | - "=", |
1085 | | - "AnimationElapsedTime" |
| 1046 | + "type": "BuiltinCommonInstructions::Standard", |
| 1047 | + "conditions": [ |
| 1048 | + { |
| 1049 | + "type": { |
| 1050 | + "value": "BuiltinCommonInstructions::CompareNumbers" |
| 1051 | + }, |
| 1052 | + "parameters": [ |
| 1053 | + "abs(Object.Behavior::DirectionDifference(NewAnimationDirection, AnimationDirection))", |
| 1054 | + ">", |
| 1055 | + "0.5 + 0.03125" |
| 1056 | + ] |
| 1057 | + } |
| 1058 | + ], |
| 1059 | + "actions": [], |
| 1060 | + "events": [ |
| 1061 | + { |
| 1062 | + "type": "BuiltinCommonInstructions::Standard", |
| 1063 | + "conditions": [], |
| 1064 | + "actions": [ |
| 1065 | + { |
| 1066 | + "type": { |
| 1067 | + "value": "SetNumberVariable" |
| 1068 | + }, |
| 1069 | + "parameters": [ |
| 1070 | + "AnimationDirection", |
| 1071 | + "=", |
| 1072 | + "mod(mod(round(NewAnimationDirection), DirectionCount) + DirectionCount, DirectionCount)" |
| 1073 | + ] |
| 1074 | + }, |
| 1075 | + { |
| 1076 | + "type": { |
| 1077 | + "value": "SetNumberVariable" |
| 1078 | + }, |
| 1079 | + "parameters": [ |
| 1080 | + "AnimationElapsedTime", |
| 1081 | + "=", |
| 1082 | + "Object.Animation::ElapsedTime()" |
| 1083 | + ] |
| 1084 | + }, |
| 1085 | + { |
| 1086 | + "type": { |
| 1087 | + "value": "TopDownMovementAnimator::TopDownMovementAnimator::UpdateAnimationName" |
| 1088 | + }, |
| 1089 | + "parameters": [ |
| 1090 | + "Object", |
| 1091 | + "Behavior", |
| 1092 | + "" |
| 1093 | + ] |
| 1094 | + }, |
| 1095 | + { |
| 1096 | + "type": { |
| 1097 | + "value": "AnimatableCapability::AnimatableBehavior::SetElapsedTime" |
| 1098 | + }, |
| 1099 | + "parameters": [ |
| 1100 | + "Object", |
| 1101 | + "Animation", |
| 1102 | + "=", |
| 1103 | + "AnimationElapsedTime" |
| 1104 | + ] |
| 1105 | + } |
| 1106 | + ], |
| 1107 | + "variables": [ |
| 1108 | + { |
| 1109 | + "folded": true, |
| 1110 | + "name": "AnimationElapsedTime", |
| 1111 | + "type": "number", |
| 1112 | + "value": 0 |
| 1113 | + } |
| 1114 | + ] |
| 1115 | + } |
1086 | 1116 | ] |
1087 | 1117 | } |
1088 | 1118 | ], |
1089 | 1119 | "variables": [ |
1090 | 1120 | { |
1091 | 1121 | "folded": true, |
1092 | | - "name": "AnimationElapsedTime", |
| 1122 | + "name": "NewAnimationDirection", |
1093 | 1123 | "type": "number", |
1094 | 1124 | "value": 0 |
1095 | 1125 | } |
|
1107 | 1137 | "name": "Behavior", |
1108 | 1138 | "supplementaryInformation": "TopDownMovementAnimator::TopDownMovementAnimator", |
1109 | 1139 | "type": "behavior" |
1110 | | - }, |
1111 | | - { |
1112 | | - "description": "Direction", |
1113 | | - "name": "NewDirection", |
1114 | | - "type": "expression" |
1115 | 1140 | } |
1116 | 1141 | ], |
1117 | 1142 | "objectGroups": [] |
|
0 commit comments