You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extends Node
class Wave:
extends Node
export var spawn_data = {}
export var flag = false
# # Uncomment to fix
#func _init():
# spawn_data = {}
func reset_waves():
if true:
var wave = Wave.new()
wave.name = "Wave_1"
wave.spawn_data[ 50] = ['L1']
wave.flag = true
$Map.add_child(wave)
wave.owner = $Map
print(wave.flag, wave.spawn_data)
if true:
var wave = Wave.new()
wave.name = "Wave_2"
wave.spawn_data[111] = ['L1']
$Map.add_child(wave)
wave.owner = $Map
print(wave.flag, wave.spawn_data)
return
func _ready():
reset_waves()
Expected:
True{50:[L1]}
False{111:[L1]}
Got:
True{50:[L1]}
False{111:[L1], 50:[L1]}
I expect initial value to be constant and all instances would have it's duplicate. Turns out I expect too much, as initial value is shared until 'duplicate' is called. Maybe we should add special keyword for this behavior? Like, I dunno, 'static'? Sounds legit to me.
The text was updated successfully, but these errors were encountered:
Once upon a time: #24134
Today: Godot Engine v3.2.3.stable.official
Expected:
Got:
I expect initial value to be constant and all instances would have it's duplicate. Turns out I expect too much, as initial value is shared until 'duplicate' is called. Maybe we should add special keyword for this behavior? Like, I dunno, 'static'? Sounds legit to me.
The text was updated successfully, but these errors were encountered: