Skip to content

Commit b89f557

Browse files
authored
[Fire Bullet] [Reviewed] Added action to "fire bullets at an object" (#897)
* Added action to fire bullets at an object.
1 parent e24aa67 commit b89f557

File tree

1 file changed

+97
-30
lines changed

1 file changed

+97
-30
lines changed

extensions/reviewed/FireBullet.json

Lines changed: 97 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "FireBullet",
99
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/bullet.svg",
1010
"shortDescription": "Fire bullets, manage ammo, reloading and overheating.",
11-
"version": "0.6.2",
11+
"version": "0.6.3",
1212
"description": [
1313
"This extension allows objects to fire bullets.",
1414
"",
@@ -138,8 +138,7 @@
138138
"textG": 0,
139139
"textR": 0
140140
},
141-
"comment": "Creators can use the \"FireBullet\" action multiple times in a frame and it will be counted as a single \"shot\".",
142-
"comment2": ""
141+
"comment": "Creators can use the \"FireBullet\" action multiple times in a frame and it will be counted as a single \"shot\"."
143142
},
144143
{
145144
"type": "BuiltinCommonInstructions::Standard",
@@ -202,8 +201,7 @@
202201
"textG": 0,
203202
"textR": 0
204203
},
205-
"comment": "Subtract 1 from ammo (if not unlimited ammo)",
206-
"comment2": ""
204+
"comment": "Subtract 1 from ammo (if not unlimited ammo)"
207205
},
208206
{
209207
"type": "BuiltinCommonInstructions::Standard",
@@ -355,8 +353,7 @@
355353
"textG": 0,
356354
"textR": 0
357355
},
358-
"comment": "Increase heat (if needed)",
359-
"comment2": ""
356+
"comment": "Increase heat (if needed)"
360357
},
361358
{
362359
"type": "BuiltinCommonInstructions::Standard",
@@ -397,8 +394,7 @@
397394
"textG": 0,
398395
"textR": 0
399396
},
400-
"comment": "Check if this caused overheat",
401-
"comment2": ""
397+
"comment": "Check if this caused overheat"
402398
},
403399
{
404400
"type": "BuiltinCommonInstructions::Standard",
@@ -523,8 +519,7 @@
523519
"textG": 0,
524520
"textR": 0
525521
},
526-
"comment": "Detect when reload is completed",
527-
"comment2": ""
522+
"comment": "Detect when reload is completed"
528523
},
529524
{
530525
"type": "BuiltinCommonInstructions::Standard",
@@ -613,8 +608,7 @@
613608
"textG": 0,
614609
"textR": 0
615610
},
616-
"comment": "Only reload the amount of ammo available",
617-
"comment2": ""
611+
"comment": "Only reload the amount of ammo available"
618612
},
619613
{
620614
"type": "BuiltinCommonInstructions::Standard",
@@ -754,6 +748,87 @@
754748
],
755749
"objectGroups": []
756750
},
751+
{
752+
"description": "Fire bullets toward an object.",
753+
"fullName": "Fire bullets toward an object",
754+
"functionType": "Action",
755+
"name": "FireTowardObject",
756+
"sentence": "Fire _PARAM4_ from _PARAM0_, at position _PARAM2_; _PARAM3_, toward _PARAM5_ with speed _PARAM6_ px/s",
757+
"events": [
758+
{
759+
"colorB": 228,
760+
"colorG": 176,
761+
"colorR": 74,
762+
"creationTime": 0,
763+
"name": "Calculate the trajectory angle and use the \"Fire bullets\" action",
764+
"source": "",
765+
"type": "BuiltinCommonInstructions::Group",
766+
"events": [
767+
{
768+
"type": "BuiltinCommonInstructions::Standard",
769+
"conditions": [],
770+
"actions": [
771+
{
772+
"type": {
773+
"value": "FireBullet::FireBullet::Fire"
774+
},
775+
"parameters": [
776+
"Object",
777+
"Behavior",
778+
"GetArgumentAsNumber(\"XPosition\")",
779+
"GetArgumentAsNumber(\"YPosition\")",
780+
"Bullet",
781+
"Object.AngleToObject(TargetObject)",
782+
"GetArgumentAsNumber(\"Speed\")",
783+
""
784+
]
785+
}
786+
]
787+
}
788+
],
789+
"parameters": []
790+
}
791+
],
792+
"parameters": [
793+
{
794+
"description": "Object",
795+
"name": "Object",
796+
"type": "object"
797+
},
798+
{
799+
"description": "Behavior",
800+
"name": "Behavior",
801+
"supplementaryInformation": "FireBullet::FireBullet",
802+
"type": "behavior"
803+
},
804+
{
805+
"description": "X position, where to create the bullet",
806+
"name": "XPosition",
807+
"type": "expression"
808+
},
809+
{
810+
"description": "Y position, where to create the bullet",
811+
"name": "YPosition",
812+
"type": "expression"
813+
},
814+
{
815+
"description": "The bullet object",
816+
"name": "Bullet",
817+
"type": "objectListOrEmptyIfJustDeclared"
818+
},
819+
{
820+
"description": "Target object",
821+
"name": "TargetObject",
822+
"type": "objectList"
823+
},
824+
{
825+
"description": "Speed of the bullet, in pixels per second",
826+
"name": "Speed",
827+
"type": "expression"
828+
}
829+
],
830+
"objectGroups": []
831+
},
757832
{
758833
"description": "Fire bullets toward a position.",
759834
"fullName": "Fire bullets toward a position",
@@ -784,7 +859,7 @@
784859
"GetArgumentAsNumber(\"XPosition\")",
785860
"GetArgumentAsNumber(\"YPosition\")",
786861
"Bullet",
787-
"Object.AngleToPosition(GetArgumentAsNumber(\"TargetXPosition\"),GetArgumentAsNumber(\"TargetYPosition\"))",
862+
"Object.AngleToPosition(GetArgumentAsNumber(\"TargetXPosition\"), GetArgumentAsNumber(\"TargetYPosition\"))",
788863
"GetArgumentAsNumber(\"Speed\")",
789864
""
790865
]
@@ -1007,8 +1082,7 @@
10071082
"textG": 0,
10081083
"textR": 0
10091084
},
1010-
"comment": "Move temp variable to the next angle a bullet will be sent",
1011-
"comment2": ""
1085+
"comment": "Move temp variable to the next angle a bullet will be sent"
10121086
},
10131087
{
10141088
"type": "BuiltinCommonInstructions::Standard",
@@ -1119,8 +1193,7 @@
11191193
"textG": 0,
11201194
"textR": 0
11211195
},
1122-
"comment": "Create bullet",
1123-
"comment2": ""
1196+
"comment": "Create bullet"
11241197
},
11251198
{
11261199
"type": "BuiltinCommonInstructions::Standard",
@@ -1150,8 +1223,7 @@
11501223
"textG": 0,
11511224
"textR": 0
11521225
},
1153-
"comment": "Move bullet (apply angle and bullet speed variances)",
1154-
"comment2": ""
1226+
"comment": "Move bullet (apply angle and bullet speed variances)"
11551227
},
11561228
{
11571229
"type": "BuiltinCommonInstructions::Standard",
@@ -1191,8 +1263,7 @@
11911263
"textG": 0,
11921264
"textR": 0
11931265
},
1194-
"comment": "Add identifier variables (to enable advanced picking by users)",
1195-
"comment2": ""
1266+
"comment": "Add identifier variables (to enable advanced picking by users)"
11961267
},
11971268
{
11981269
"type": "BuiltinCommonInstructions::Standard",
@@ -1243,8 +1314,7 @@
12431314
"textG": 0,
12441315
"textR": 0
12451316
},
1246-
"comment": "Rotate newly created bullet, if needed",
1247-
"comment2": ""
1317+
"comment": "Rotate newly created bullet, if needed"
12481318
},
12491319
{
12501320
"type": "BuiltinCommonInstructions::Standard",
@@ -1284,8 +1354,7 @@
12841354
"textG": 0,
12851355
"textR": 0
12861356
},
1287-
"comment": "Update statistics",
1288-
"comment2": ""
1357+
"comment": "Update statistics"
12891358
},
12901359
{
12911360
"type": "BuiltinCommonInstructions::Standard",
@@ -3759,8 +3828,7 @@
37593828
"textG": 0,
37603829
"textR": 0
37613830
},
3762-
"comment": "If Max Ammo is set, do not exceed the value",
3763-
"comment2": ""
3831+
"comment": "If Max Ammo is set, do not exceed the value"
37643832
},
37653833
{
37663834
"type": "BuiltinCommonInstructions::Standard",
@@ -4623,8 +4691,7 @@
46234691
"textG": 0,
46244692
"textR": 0
46254693
},
4626-
"comment": "Shots per reload must not be \"0\"",
4627-
"comment2": ""
4694+
"comment": "Shots per reload must not be \"0\""
46284695
},
46294696
{
46304697
"type": "BuiltinCommonInstructions::Standard",

0 commit comments

Comments
 (0)