snake gaming

This commit is contained in:
Tabby 2025-08-08 15:02:44 +10:00
parent 737128614a
commit f0f173ee06
7 changed files with 83 additions and 9 deletions

24
camera_2d.gd Normal file
View file

@ -0,0 +1,24 @@
extends Camera2D
var target : Node2D
@export var temp_segment : Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if (Input.is_action_just_pressed("test_switch_cam")):
if(target):
target = null
else:
target = temp_segment
if target:
position = lerp(position, target.position, 0.1 * delta)
zoom = lerp(zoom, Vector2(1,1),0.1 * delta)
else:
position = Vector2(0,0)
zoom = Vector2(0.05,0.05)