Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Godotuser5675 |
When I change the values in the inspector nothing happens.
Here is some of my code:
extends KinematicBody2D
export var speed = 100
export var walk_speed = 50
export var dash_speed = 500
export var tileSize = 32.0
export var max_speed = 500
onready var current_speed = speed
onready var lazer_beam = preload("res://scenes/LazerBeam.tscn")
onready var bullet = preload("res://scenes/Bullet.tscn")
var lazer = null
const stamina_loss_captain = 1
export var stamina_lost = {
"Teleport": 180,
"Attack": 70
}
export var stam = {
"Initial Max": 2000,
"Current Max": 2000,
"Regeneration": 100,
"Current" : 2000
}
class energy :
var initial_max = 0
var current_max = 0
var regeneration = 0
var current = 0
func _init(im = 200, cm = 200, regen = 40, cur = 0):
initial_max = im
current_max = cm
regeneration = regen
current = cur
func regenerate(delta):
current += regeneration * delta
if(current >= current_max):
current = current_max
func left():
if current > 0:
return true
else:
return false
return false
func deplete(amount):
current -= amount
#If current does not go under zero after depletion return true else return false
func test_deplete(amount):
if(current - amount >= 0):
return true
else:
return false
func if_left_deplete(amount):
if(left()):
deplete(amount)
return true
else:
return false
func if_not_under_zero_when_depleted(amount):
if(current - amount >= 0):
deplete(amount)
return true
else:
return false
var stamina = energy.new(stam["Initial Max"], stam["Current Max"], stam["Regeneration"], stam["Current"])
So I later found out that if I change the original scenes dictionary values in the inspector and not the instanced scene of it or an inherited scene of it the values do change but not otherwise.