look like it works now, i did a workaround, dunno what this issue was 💀
This commit is contained in:
parent
7584cf0b19
commit
8c0860a840
8 changed files with 64 additions and 44 deletions
21
camera_2d.gd
21
camera_2d.gd
|
|
@ -1,9 +1,11 @@
|
|||
extends Camera2D
|
||||
|
||||
var target : Node2D
|
||||
@export var temp_segment : Node2D
|
||||
#var target : Node2D
|
||||
#@export var temp_segment : Node2D
|
||||
@export var snake_line : Line2D
|
||||
|
||||
@export var player : Node2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
|
@ -11,22 +13,21 @@ func _ready() -> void:
|
|||
|
||||
# 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:
|
||||
|
||||
if Router.player_mode:
|
||||
# TODO FIX
|
||||
#position = lerp(position, target.position, 0.6 * delta)
|
||||
#zoom = lerp(zoom, Vector2(1,1),0.6 * delta)
|
||||
position = target.position
|
||||
#position = Router.current_seg.position
|
||||
position = player.global_position
|
||||
zoom = Vector2(1,1)
|
||||
snake_line.modulate = Color(1,1,1,0.5)
|
||||
snake_line.modulate = Color(1,1,1,1)
|
||||
z_index = 0
|
||||
snake_line.z_index = 9
|
||||
else:
|
||||
position = Vector2(0,0)
|
||||
zoom = Vector2(0.05,0.05)
|
||||
snake_line.modulate = Color(1,1,1,1)
|
||||
snake_line.z_index = 11
|
||||
z_index = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue