Skip to content

Commit 85d8766

Browse files
committed
Add an "activate" action to the button.
1 parent 81927e5 commit 85d8766

File tree

1 file changed

+223
-4
lines changed

1 file changed

+223
-4
lines changed

examples/resource-bar/game.json

Lines changed: 223 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3946,8 +3946,61 @@
39463946
},
39473947
{
39483948
"type": "BuiltinCommonInstructions::Standard",
3949-
"conditions": [],
3950-
"actions": []
3949+
"conditions": [
3950+
{
3951+
"type": {
3952+
"value": "KeyPressed"
3953+
},
3954+
"parameters": [
3955+
"",
3956+
"d"
3957+
]
3958+
},
3959+
{
3960+
"type": {
3961+
"value": "BuiltinCommonInstructions::Once"
3962+
},
3963+
"parameters": []
3964+
}
3965+
],
3966+
"actions": [
3967+
{
3968+
"type": {
3969+
"value": "PanelSpriteButton::PanelSpriteButton::Activate"
3970+
},
3971+
"parameters": [
3972+
"YellowButton",
3973+
"",
3974+
""
3975+
]
3976+
}
3977+
]
3978+
},
3979+
{
3980+
"type": "BuiltinCommonInstructions::Standard",
3981+
"conditions": [
3982+
{
3983+
"type": {
3984+
"value": "KeyReleased"
3985+
},
3986+
"parameters": [
3987+
"",
3988+
"d"
3989+
]
3990+
}
3991+
],
3992+
"actions": [
3993+
{
3994+
"type": {
3995+
"value": "PanelSpriteButton::PanelSpriteButton::Activate"
3996+
},
3997+
"parameters": [
3998+
"YellowButton",
3999+
"yes",
4000+
""
4001+
]
4002+
}
4003+
]
39514004
}
39524005
],
39534006
"layers": [
@@ -12132,7 +12185,7 @@
1213212185
"name": "PanelSpriteButton",
1213312186
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg",
1213412187
"shortDescription": "A button that can be customized.",
12135-
"version": "1.3.1",
12188+
"version": "1.4.0",
1213612189
"description": [
1213712190
"The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.",
1213812191
"",
@@ -12810,6 +12863,56 @@
1281012863
],
1281112864
"objectGroups": []
1281212865
},
12866+
{
12867+
"fullName": "",
12868+
"functionType": "Action",
12869+
"name": "onDeActivate",
12870+
"sentence": "",
12871+
"events": [
12872+
{
12873+
"type": "BuiltinCommonInstructions::Standard",
12874+
"conditions": [],
12875+
"actions": [
12876+
{
12877+
"type": {
12878+
"value": "PanelSpriteButton::ButtonFSM::SetPropertyState"
12879+
},
12880+
"parameters": [
12881+
"Object",
12882+
"Behavior",
12883+
"=",
12884+
"\"Idle\""
12885+
]
12886+
},
12887+
{
12888+
"type": {
12889+
"value": "PanelSpriteButton::ButtonFSM::SetPropertyTouchId"
12890+
},
12891+
"parameters": [
12892+
"Object",
12893+
"Behavior",
12894+
"=",
12895+
"0"
12896+
]
12897+
}
12898+
]
12899+
}
12900+
],
12901+
"parameters": [
12902+
{
12903+
"description": "Object",
12904+
"name": "Object",
12905+
"type": "object"
12906+
},
12907+
{
12908+
"description": "Behavior",
12909+
"name": "Behavior",
12910+
"supplementaryInformation": "PanelSpriteButton::ButtonFSM",
12911+
"type": "behavior"
12912+
}
12913+
],
12914+
"objectGroups": []
12915+
},
1281312916
{
1281412917
"description": "Check if the button is not used.",
1281512918
"fullName": "Is idle",
@@ -13246,7 +13349,7 @@
1324613349
{
1324713350
"defaultName": "Button",
1324813351
"description": "A button that can be customized.",
13249-
"fullName": "Panel sprite button",
13352+
"fullName": "Button (panel sprite)",
1325013353
"name": "PanelSpriteButton",
1325113354
"eventsFunctions": [
1325213355
{
@@ -14421,6 +14524,122 @@
1442114524
]
1442214525
}
1442314526
]
14527+
},
14528+
{
14529+
"description": "De/activate interactions with the button.",
14530+
"fullName": "De/activate interactions",
14531+
"functionType": "Action",
14532+
"name": "Activate",
14533+
"sentence": "De/activate interactions with _PARAM0_",
14534+
"events": [
14535+
{
14536+
"type": "BuiltinCommonInstructions::Standard",
14537+
"conditions": [
14538+
{
14539+
"type": {
14540+
"value": "GetArgumentAsBoolean"
14541+
},
14542+
"parameters": [
14543+
"\"ShouldActivate\""
14544+
]
14545+
}
14546+
],
14547+
"actions": [
14548+
{
14549+
"type": {
14550+
"value": "ActivateBehavior"
14551+
},
14552+
"parameters": [
14553+
"Idle",
14554+
"ButtonFSM",
14555+
"yes"
14556+
]
14557+
}
14558+
]
14559+
},
14560+
{
14561+
"type": "BuiltinCommonInstructions::Standard",
14562+
"conditions": [
14563+
{
14564+
"type": {
14565+
"inverted": true,
14566+
"value": "GetArgumentAsBoolean"
14567+
},
14568+
"parameters": [
14569+
"\"ShouldActivate\""
14570+
]
14571+
}
14572+
],
14573+
"actions": [
14574+
{
14575+
"type": {
14576+
"value": "ActivateBehavior"
14577+
},
14578+
"parameters": [
14579+
"Idle",
14580+
"ButtonFSM",
14581+
"no"
14582+
]
14583+
}
14584+
]
14585+
}
14586+
],
14587+
"parameters": [
14588+
{
14589+
"description": "Object",
14590+
"name": "Object",
14591+
"supplementaryInformation": "PanelSpriteButton::PanelSpriteButton",
14592+
"type": "object"
14593+
},
14594+
{
14595+
"description": "Activate",
14596+
"name": "ShouldActivate",
14597+
"type": "yesorno"
14598+
}
14599+
],
14600+
"objectGroups": []
14601+
},
14602+
{
14603+
"description": "Check if interactions are activated on the button.",
14604+
"fullName": "Interactions activated",
14605+
"functionType": "Condition",
14606+
"name": "IsActivated",
14607+
"sentence": "Interactions on _PARAM0_ are activated",
14608+
"events": [
14609+
{
14610+
"type": "BuiltinCommonInstructions::Standard",
14611+
"conditions": [
14612+
{
14613+
"type": {
14614+
"value": "BehaviorActivated"
14615+
},
14616+
"parameters": [
14617+
"Idle",
14618+
"ButtonFSM"
14619+
]
14620+
}
14621+
],
14622+
"actions": [
14623+
{
14624+
"type": {
14625+
"value": "SetReturnBoolean"
14626+
},
14627+
"parameters": [
14628+
"True"
14629+
]
14630+
}
14631+
]
14632+
}
14633+
],
14634+
"parameters": [
14635+
{
14636+
"description": "Object",
14637+
"name": "Object",
14638+
"supplementaryInformation": "PanelSpriteButton::PanelSpriteButton",
14639+
"type": "object"
14640+
}
14641+
],
14642+
"objectGroups": []
1442414643
}
1442514644
],
1442614645
"propertyDescriptors": [

0 commit comments

Comments
 (0)