Skip to content

Commit

Permalink
Changes the refund amount to 50% when selling
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasdotcom committed Feb 17, 2022
1 parent c56f20a commit 0d3d064
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
23 changes: 1 addition & 22 deletions src/Data.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,6 @@ func _ready() -> void:
if file.file_exists(save_file): # Checks for a save file and then loads all the data from it
file.open(save_file, File.READ)
var _data = parse_json(file.get_as_text())
if _data["version"] == "v0.1.3": # updates save to v0.1.4
for x in range(7, 21):
_data["cost"][x] = cost[x]
_data["version"] = "v0.1.4"
if _data["version"] == "v0.1.4": # updates save to v0.1.4
# Removes the last 6 elements because those were removed
_data["cost"].pop_back()
_data["cost"].pop_back()
_data["cost"].pop_back()
_data["cost"].pop_back()
_data["cost"].pop_back()
_data["cost"].pop_back()
_data["version"] = "v0.1.5"
if _data["version"] == "v0.1.5":
for x in range(15):
_data["cost"][x] = floor(_data["cost"][x] / 10)
_data["version"] = "v0.3.0"
if _data["version"] == "v0.3.0": # Introduces the save for balls
_data["balls"] = balls
_data["ball_upgrades"] = false
_data["version"] = "v0.4.0"
if _data["version"] == "v0.5.0": # Loads the save
balls = _data["balls"]
money = _data["money"]
Expand Down Expand Up @@ -93,7 +72,7 @@ func save() -> void: # Used to save the game
"cost" : cost,
"ball_upgrades" : ball_upgrades,
"balls" : balls,
"version" : "v0.4.0"
"version" : "v0.5.0"
})
file.store_string(_save_data)
file.close()
Expand Down
2 changes: 1 addition & 1 deletion src/purchase.gd
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func _on_Buy_mouse_exited() -> void:
func _on_Sell_button_up() -> void:
if Data.box_number(level) > 0:
Data.cost[level] = ceil(Data.cost[level] / 1.15)
Data.money += Data.cost[level]
Data.money += ceil(Data.cost[level] * 0.5)
for x in get_node("/root/Main/Game Field").get_children():
if "box" in x.get_name():
if x.level == level:
Expand Down

0 comments on commit 0d3d064

Please sign in to comment.