diff --git a/src/entities/behaviours/ErraticMovement.gd b/src/entities/behaviours/ErraticMovement.gd index bfaa218..653fa5c 100644 --- a/src/entities/behaviours/ErraticMovement.gd +++ b/src/entities/behaviours/ErraticMovement.gd @@ -5,7 +5,12 @@ export var movement_per_second: float = 16.0 onready var target: KinematicBody2D = get_parent() -onready var rng = RandomNumberGenerator.new() +var rng: RandomNumberGenerator + + +func _ready(): + rng = RandomNumberGenerator.new() + rng.randomize() func _physics_process(_delta): diff --git a/src/entities/behaviours/SpriteRandomRotation.gd b/src/entities/behaviours/SpriteRandomRotation.gd index af570cf..5a94ccb 100644 --- a/src/entities/behaviours/SpriteRandomRotation.gd +++ b/src/entities/behaviours/SpriteRandomRotation.gd @@ -1,11 +1,8 @@ extends Sprite -var rng : RandomNumberGenerator = RandomNumberGenerator.new() +var rng: RandomNumberGenerator func _ready(): + rng = RandomNumberGenerator.new() rng.randomize() - self.rotate(rng.randf_range(0,360)) - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass + self.rotate(rng.randf() * 2 * PI)