-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a limit to the amount of boxes and a way to upgrade the limit
- Loading branch information
1 parent
0d3d064
commit da208ba
Showing
5 changed files
with
88 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
extends Control | ||
onready var button = $Buy | ||
onready var text = $Popup/Earnings | ||
onready var popup = $Popup | ||
|
||
var level: int = 1 | ||
var ball: bool = false | ||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready() -> void: | ||
Data.connect("update_game_interface", self, "update_interface") | ||
update_interface() | ||
|
||
func update_interface() -> void: # Updates the buttons data | ||
button.text = "Purchase 10 more boxes for %s" % Data.beautify(Data.box_number_cost()) | ||
text.text = "You have %s of %s boxes" % [Data.box_number(), Data.box_limit] | ||
button.disabled = Data.box_number_cost() > Data.money | ||
|
||
func _on_Buy_button_up() -> void: # Used to pruchase | ||
var _cost = Data.box_number_cost() | ||
if _cost <= Data.money: | ||
Data.box_limit += 10 | ||
Data.money -= _cost | ||
|
||
func _on_Buy_mouse_entered() -> void: | ||
popup.show() | ||
|
||
func _on_Buy_mouse_exited() -> void: | ||
popup.hide() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters