Ouroboros/Scripts/ouroboros.gd

13 lines
354 B
GDScript

extends Sprite2D
const ROTATION_SPEED = 0.2
var last_rotation_mult = 1
func _process(delta: float) -> void:
var head = get_tree().get_first_node_in_group("Head")
if head is SnakePart:
modulate = head.COLOURS[[head.colour_index % len(head.COLOURS)]]
last_rotation_mult = head.colour_index + 1
rotate(delta * ROTATION_SPEED * last_rotation_mult)