1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-25 09:34:24 +00:00

SkitterFromMouse: it turns out randi_range is inclusive

This commit is contained in:
Steffo 2024-04-14 05:01:27 +02:00
parent edf61001af
commit ff3c0d97d3
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -38,7 +38,7 @@ func _physics_process(delta: float) -> void:
match state: match state:
State.SCARED: State.SCARED:
if len(directions) > 0: if len(directions) > 0:
var idx := Random.rng.randi_range(0, len(directions)) var idx := Random.rng.randi_range(0, len(directions) - 1)
var direction: Vector2 = directions[idx] var direction: Vector2 = directions[idx]
var movement: Vector2 = direction * delta * speed var movement: Vector2 = direction * delta * speed
move.emit(movement) move.emit(movement)