Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Go Save The King
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Htoo Aung (kha451)
Go Save The King
Commits
15675310
Commit
15675310
authored
1 month ago
by
Alan
Browse files
Options
Downloads
Patches
Plain Diff
Fixed representation of purchased pieces/upgrades in game.gd
parent
79e6eab0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/game.gd
+11
-5
11 additions, 5 deletions
scripts/game.gd
with
11 additions
and
5 deletions
scripts/game.gd
+
11
−
5
View file @
15675310
...
...
@@ -522,16 +522,20 @@ func _on_purchase_attempted(item_data: Dictionary, shop_item: Node):
shop_item
.
get_node
(
"Overlay"
)
.
visible
=
true
shop_item
.
get_node
(
"MarginContainer/VBoxContainer/BuyButton"
)
.
disabled
=
true
# Track purchased items
if
item_data
in
shop
.
shop_items
[
"pieces"
]:
# Creates an array of piece / upgrade names.
var
piece_names
=
shop
.
shop_items
[
"pieces"
]
.
map
(
func
(
item
):
return
item
[
"name"
])
var
upgrade_names
=
shop
.
shop_items
[
"upgrades"
]
.
map
(
func
(
item
):
return
item
[
"name"
])
# checks if the purchased item’s name exists in the list of pieces or upgrades.
if
item_data
[
"name"
]
in
piece_names
:
print
(
"Purchased piece: "
,
item_data
[
"name"
])
purchased_pieces
.
append
(
item_data
)
elif
item_data
in
shop
.
shop_items
[
"upgrades"
]:
elif
item_data
[
"name"
]
in
upgrade_names
:
print
(
"Purchased upgrade: "
,
item_data
[
"name"
])
purchased_upgrades
.
append
(
item_data
)
# Update UI and print debug info
update_gold_display
()
print
(
"Purchased: "
,
item_data
[
"name"
])
print
(
"Remaining gold: "
,
player_gold
)
else
:
# TODO: Play sound / animation for not enough gold
print
(
"Not enough gold!"
)
...
...
@@ -550,6 +554,8 @@ func _on_next_round_requested():
piece_container
.
visible
=
true
# Show the board
shadow_container
.
visible
=
true
tile_container
.
visible
=
true
print
(
"Player items in purchased_pieces: "
,
purchased_pieces
)
print
(
"Player upgrades in purchased_upgrades: "
,
purchased_upgrades
)
func
set_gold_display_position
():
# Set anchors to a percentage of the parent container's size
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment