Skip to content

Commit ffba508

Browse files
authored
[FireBullet] [Reviewed] Added bullet speed variance (useful for a shotgun effect) (#778)
Each bullet's speed will be adjusted by a random value within this range (pixels/second).
1 parent 20d8db9 commit ffba508

File tree

1 file changed

+130
-31
lines changed

1 file changed

+130
-31
lines changed

extensions/reviewed/FireBullet.json

Lines changed: 130 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,40 @@
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.3.3",
11+
"version": "0.4.1",
1212
"description": [
13-
"This extension allows objects to fire bullets.",
13+
"Fire bullets, manage ammo, reloading, and overheating.",
1414
"",
15-
"It handles:",
16-
"- cooldown between shots",
17-
"- firing multiple bullets at a time",
18-
"- ammo management",
19-
"- overheat",
15+
"Firing bullets:",
16+
"- Cooldown: Time between shots (seconds)",
17+
"- Bullet Quantity: Number of bullets created each time Fire Bullet action is used. ",
18+
"- Firing Arc: Range of angles (in degrees) that bullets will shoot. Bullets are evenly spread within this range.",
19+
"- Rotate bullet: Change the angle of each bullet to match the direction it is travelling (enabled by default)",
20+
"- Angle Variance: Each bullet trajectory will be adjusted by a random value within this range (degrees)",
21+
"- Bullet speed variance: Each bullet speed will be adjusted by a random value within this range (pixels/second)",
2022
"",
21-
"[A simplified version](https://editor.gdevelop.io/?project=example://fire-bullet) of the top-down twin-stick shooter example allows to check it out."
23+
" Ammo:",
24+
"- Starting ammo",
25+
"- Max ammo",
26+
"- Shots per reload. Use 0 to disable reloading",
27+
"- Reload duration",
28+
"- Automatic reloading is enabled by default, but it can also be done manually.",
29+
"",
30+
"Overheat:",
31+
"- Heat increase per shot. Object is Overheated when Heat reaches 1.",
32+
"- Cooling rate per second",
33+
"- When overheated, the object cannot fire any bullets",
34+
"",
35+
"Statistics:",
36+
"- Total bullets created",
37+
"- Total shots taken",
38+
"- Total reloads completed",
39+
"",
40+
"Bullets:",
41+
"- Each bullet is assigned several variables that can be used for advanced object picking",
42+
"- __FireBullet.BulletID = Unique number for every bullet created",
43+
"- __FireBullet.BatchID = Unique number for all bullets created in the same frame",
44+
"- __FireBullet.BatchOrderID = Unique number for each bullet in the same batch. Can be used to identify the position in the firing arc."
2245
],
2346
"origin": {
2447
"identifier": "FireBullet",
@@ -751,7 +774,7 @@
751774
"objectGroups": []
752775
},
753776
{
754-
"description": "Fire bullets toward a position.\n\nEach bullet is assigned variables for advanced object picking\n- __FireBullet.BulletID, Unique number for every bullet created\n- __FireBullet.BatchID, Unique number for all bullets created in the same frame\n- __FireBullet.BatchOrderID, Unique number for each bullet in the same batch. Can be used to identify the position in the firing arc.",
777+
"description": "Fire bullets toward a position.",
755778
"fullName": "Fire bullets toward a position",
756779
"functionType": "Action",
757780
"name": "FireTowardPosition",
@@ -837,7 +860,7 @@
837860
"objectGroups": []
838861
},
839862
{
840-
"description": "Fire bullets in the direction of a given angle.\n\nEach bullet is assigned variables for advanced object picking\n- __FireBullet.BulletID, Unique number for every bullet created\n- __FireBullet.BatchID, Unique number for all bullets created in the same frame\n- __FireBullet.BatchOrderID, Unique number for each bullet in the same batch. Can be used to identify the position in the firing arc.",
863+
"description": "Fire bullets in the direction of a given angle.",
841864
"fullName": "Fire bullets toward an angle",
842865
"functionType": "Action",
843866
"name": "Fire",
@@ -1146,32 +1169,21 @@
11461169
"textG": 0,
11471170
"textR": 0
11481171
},
1149-
"comment": "Move bullet",
1172+
"comment": "Move bullet (apply angle and bullet speed variances)",
11501173
"comment2": ""
11511174
},
11521175
{
11531176
"type": "BuiltinCommonInstructions::Standard",
11541177
"conditions": [],
11551178
"actions": [
1156-
{
1157-
"type": {
1158-
"value": "FireBullet::FireBullet::SetPropertyRandomizedAngle"
1159-
},
1160-
"parameters": [
1161-
"Object",
1162-
"Behavior",
1163-
"=",
1164-
"GetArgumentAsNumber(\"Angle\") + RandomInRange(-Object.Behavior::PropertyAngleVariance(), Object.Behavior::PropertyAngleVariance())"
1165-
]
1166-
},
11671179
{
11681180
"type": {
11691181
"value": "AddForceAL"
11701182
},
11711183
"parameters": [
11721184
"Bullet",
1173-
"Object.Behavior::PropertyRandomizedAngle()",
1174-
"GetArgumentAsNumber(\"Speed\")",
1185+
"GetArgumentAsNumber(\"Angle\") + RandomInRange(-Object.Behavior::PropertyAngleVariance(), Object.Behavior::PropertyAngleVariance())",
1186+
"GetArgumentAsNumber(\"Speed\") + RandomInRange(-Object.Behavior::PropertyBulletSpeedVariance(), Object.Behavior::PropertyBulletSpeedVariance())",
11751187
"1"
11761188
]
11771189
}
@@ -1263,7 +1275,7 @@
12631275
"parameters": [
12641276
"Bullet",
12651277
"=",
1266-
"Object.Behavior::PropertyRandomizedAngle()"
1278+
"GetArgumentAsNumber(\"Angle\")"
12671279
]
12681280
}
12691281
]
@@ -1606,6 +1618,52 @@
16061618
],
16071619
"objectGroups": []
16081620
},
1621+
{
1622+
"description": "Change the speed variance (pixels per second) applied to each bullet.",
1623+
"fullName": "Set bullet speed variance",
1624+
"functionType": "Action",
1625+
"group": "Multi-Fire",
1626+
"name": "SetBulletSpeedVariance",
1627+
"sentence": "Set bullet speed variance of _PARAM0_ to _PARAM2_ pixels per second",
1628+
"events": [
1629+
{
1630+
"type": "BuiltinCommonInstructions::Standard",
1631+
"conditions": [],
1632+
"actions": [
1633+
{
1634+
"type": {
1635+
"value": "FireBullet::FireBullet::SetPropertyBulletSpeedVariance"
1636+
},
1637+
"parameters": [
1638+
"Object",
1639+
"Behavior",
1640+
"=",
1641+
"GetArgumentAsNumber(\"Value\")"
1642+
]
1643+
}
1644+
]
1645+
}
1646+
],
1647+
"parameters": [
1648+
{
1649+
"description": "Object",
1650+
"name": "Object",
1651+
"type": "object"
1652+
},
1653+
{
1654+
"description": "Behavior",
1655+
"name": "Behavior",
1656+
"supplementaryInformation": "FireBullet::FireBullet",
1657+
"type": "behavior"
1658+
},
1659+
{
1660+
"description": "Angle variance (degrees) Range: 0 to 180",
1661+
"name": "Value",
1662+
"type": "expression"
1663+
}
1664+
],
1665+
"objectGroups": []
1666+
},
16091667
{
16101668
"description": "Change the number of bullets shot every time the \"fire bullet\" action is used.",
16111669
"fullName": "Set number of bullets per shot",
@@ -2776,6 +2834,47 @@
27762834
],
27772835
"objectGroups": []
27782836
},
2837+
{
2838+
"description": "Bullet speed variance, in pixels per second.",
2839+
"fullName": "Bullet speed variance",
2840+
"functionType": "Expression",
2841+
"group": "Multi-Fire",
2842+
"name": "BulletSpeedVariance",
2843+
"sentence": "",
2844+
"events": [
2845+
{
2846+
"type": "BuiltinCommonInstructions::Standard",
2847+
"conditions": [],
2848+
"actions": [
2849+
{
2850+
"type": {
2851+
"value": "SetReturnNumber"
2852+
},
2853+
"parameters": [
2854+
"Object.Behavior::PropertyBulletSpeedVariance()"
2855+
]
2856+
}
2857+
]
2858+
}
2859+
],
2860+
"expressionType": {
2861+
"type": "expression"
2862+
},
2863+
"parameters": [
2864+
{
2865+
"description": "Object",
2866+
"name": "Object",
2867+
"type": "object"
2868+
},
2869+
{
2870+
"description": "Behavior",
2871+
"name": "Behavior",
2872+
"supplementaryInformation": "FireBullet::FireBullet",
2873+
"type": "behavior"
2874+
}
2875+
],
2876+
"objectGroups": []
2877+
},
27792878
{
27802879
"description": "Firing arc, in degrees.",
27812880
"fullName": "Firing arc",
@@ -4421,14 +4520,14 @@
44214520
"name": "BulletLayer"
44224521
},
44234522
{
4424-
"value": "",
4523+
"value": "0",
44254524
"type": "Number",
4426-
"label": "",
4427-
"description": "",
4428-
"group": "",
4525+
"label": "Bullet speed variance (pixels/second)",
4526+
"description": "Bullet speed will be adjusted by a random value within this range (pixels/second)",
4527+
"group": "Multi-Fire",
44294528
"extraInformation": [],
4430-
"hidden": true,
4431-
"name": "RandomizedAngle"
4529+
"hidden": false,
4530+
"name": "BulletSpeedVariance"
44324531
}
44334532
],
44344533
"sharedPropertyDescriptors": []

0 commit comments

Comments
 (0)