Skip to content

Commit

Permalink
[Reviewed] [Unit bar] Fix value going out of bounds (#1560)
Browse files Browse the repository at this point in the history
  • Loading branch information
D8H authored Feb 25, 2025
1 parent c9f7a3c commit 63a29ea
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions extensions/reviewed/TiledUnitsBar.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "TiledUnitsBar",
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/063e9152cf65bc0f3be2a828afd950c3ecf1b1fc72feefdc2467252fe987dc0f_dots-horizontal.svg",
"shortDescription": "A bar that represents a resource in the game (health, mana, ammo, etc).",
"version": "1.2.0",
"version": "1.2.1",
"description": [
"A bar that represents a resource in the game (health, mana, ammo, etc).",
"",
Expand Down Expand Up @@ -124,7 +124,7 @@
"value": "SetReturnNumber"
},
"parameters": [
"Value"
"CurrentValue"
]
}
]
Expand Down Expand Up @@ -164,7 +164,7 @@
"value": "SetNumberVariable"
},
"parameters": [
"Value",
"CurrentValue",
"=",
"clamp(Value, 0, MaxValue)"
]
Expand Down Expand Up @@ -335,7 +335,7 @@
"value": "NumberVariable"
},
"parameters": [
"Value",
"CurrentValue",
"=",
"0"
]
Expand Down Expand Up @@ -383,7 +383,7 @@
"value": "NumberVariable"
},
"parameters": [
"Value",
"CurrentValue",
"=",
"MaxValue"
]
Expand Down Expand Up @@ -474,7 +474,7 @@
"parameters": [
"PreviousHighValue",
"=",
"Value"
"CurrentValue"
]
}
]
Expand Down Expand Up @@ -593,7 +593,7 @@
"Object",
"Behavior",
"!=",
"Value",
"CurrentValue",
""
]
},
Expand Down Expand Up @@ -645,7 +645,7 @@
"description": "",
"group": "",
"extraInformation": [],
"name": "Value"
"name": "CurrentValue"
},
{
"value": "3",
Expand Down Expand Up @@ -1242,6 +1242,18 @@
"name": "SetValue",
"sentence": "",
"events": [
{
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "The value is clamped by the behavior. This is why Object.Value() is used instead of Value directly."
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
Expand All @@ -1266,7 +1278,7 @@
"FillBar",
"Resizable",
"=",
"Value * Object.PropertyUnitWidth()"
"Object.Value() * UnitWidth"
]
}
]
Expand Down Expand Up @@ -1305,7 +1317,7 @@
"value": "SetReturnNumber"
},
"parameters": [
"FillBar.ResourceBar::PropertyMaxValue()"
"FillBar.ResourceBar::MaxValue()"
]
}
]
Expand Down Expand Up @@ -1355,7 +1367,7 @@
"Bar",
"Resizable",
"=",
"Value * Object.PropertyUnitWidth()"
"Value * UnitWidth"
]
},
{
Expand Down Expand Up @@ -1479,6 +1491,7 @@
{
"value": "3",
"type": "Number",
"unit": "Dimensionless",
"label": "Maximum value",
"description": "",
"group": "",
Expand All @@ -1488,6 +1501,7 @@
{
"value": "3",
"type": "Number",
"unit": "Dimensionless",
"label": "Initial value",
"description": "",
"group": "",
Expand All @@ -1507,6 +1521,7 @@
{
"value": "24",
"type": "Number",
"unit": "Pixel",
"label": "Unit width",
"description": "How much pixels to show for a value of 1.",
"group": "",
Expand All @@ -1527,6 +1542,7 @@
{
"value": "0",
"type": "Number",
"unit": "Pixel",
"label": "Bar left margin",
"description": "",
"group": "",
Expand All @@ -1539,6 +1555,7 @@
{
"value": "0",
"type": "Number",
"unit": "Pixel",
"label": "Bar right margin",
"description": "",
"group": "",
Expand Down

0 comments on commit 63a29ea

Please sign in to comment.