Godot Version
Godot 4.3
Question
Okay so im developing a game where there is an automated function where you gain money equivalent to the “Multiplier” variable every 0.5s, now, i got an upgrade where you gain more money based off the amount of points you have,
with a formula of M ** 0.21, now, i got another upgrade that just adds 1 to the multiplier, the problem, is that these conflict with eachother, if i buy the first upgrade i get the results i get, then if i buy the +1 multiplier upgrade i get the result i get for like 1 second and then its overridden by the first upgrade.
Heres the log i made with print():
where 2.6… is the result i want after buying the +1 multi upgrade and 1.6… being the first upgrade, i need to know how can i fix this.
Heres the code for the first upgrade:
extends "res://button.gd"
var Active = false
func _ready() -> void:
Cost = 6
func _on_pressed() -> void:
if Global.Money >= Cost:
disabled = state
Active = true
Global.Left_side = 1
Global.Money -= Cost
else:
state = false
disabled = state
func _pressed() -> void:
disabled = true
func _on_timer_timeout() -> void:
if Active == true:
Global.Points()
else:
return
func Points():
Global.Multi =+ (Global.Money ** 0.21)
if Global.Money <= 1:
Global.Money += 1
else:
return
and heres the code for the +1 multiplier one:
extends "res://button.gd"
func _ready() -> void:
Cost = 2
func _on_pressed() -> void:
if Global.Money >= Cost:
disabled = state
Global.Money -= Cost
Global.Multi += 1
Global.Right_side =+ 1
else:
state = false
disabled = state
func _pressed() -> void:
disabled = true
state = true
and heres the Thingy that gives you money equal to the multiplier
func _on_timer_timeout() -> void:
Global.Money += Global.Multi
(btw the really cheap cost is for debugging, ignore that.)