chicken man

This commit is contained in:
Haze Weathers 2024-02-03 02:02:25 -05:00
parent a7f5ad6db2
commit 63b24cb614
9 changed files with 1469 additions and 97 deletions

29
scripts/ball_snake.gd Normal file
View file

@ -0,0 +1,29 @@
tool
class_name BallSnake
extends Node2D
export var texture: Texture
export var segments: int = 1
export var target: NodePath
export var end_pieces: bool = true
func _process(delta: float) -> void:
update()
func _draw() -> void:
var node := get_node(target) as Node2D
if node:
if end_pieces:
draw_texture(texture, texture.get_size() * -0.5)
var end_pos := to_local(node.global_position)
for i in segments:
var weight := 1.0 / float(segments + 1) * float(i + 1)
draw_texture(
texture,
lerp(Vector2.ZERO, end_pos, weight) + texture.get_size() * -0.5
)
if end_pieces:
draw_texture(texture, end_pos + texture.get_size() * -0.5)