snake looking snakey
This commit is contained in:
parent
23b21cefbb
commit
1c0fbf3d69
3 changed files with 13 additions and 4 deletions
11
camera_2d.gd
11
camera_2d.gd
|
|
@ -2,6 +2,7 @@ extends Camera2D
|
|||
|
||||
var target : Node2D
|
||||
@export var temp_segment : Node2D
|
||||
@export var snake_line : Line2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
|
@ -18,8 +19,14 @@ func _process(delta: float) -> void:
|
|||
|
||||
if target:
|
||||
# TODO FIX
|
||||
position = lerp(position, target.position, 0.6 * delta)
|
||||
zoom = lerp(zoom, Vector2(1,1),0.6 * delta)
|
||||
#position = lerp(position, target.position, 0.6 * delta)
|
||||
#zoom = lerp(zoom, Vector2(1,1),0.6 * delta)
|
||||
position = target.position
|
||||
zoom = Vector2(1,1)
|
||||
snake_line.modulate = Color(1,1,1,0.5)
|
||||
z_index = 0
|
||||
else:
|
||||
position = Vector2(0,0)
|
||||
zoom = Vector2(0.05,0.05)
|
||||
snake_line.modulate = Color(1,1,1,1)
|
||||
z_index = 1
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func get_new_target():
|
|||
move_progress = 0
|
||||
|
||||
func become_real():
|
||||
#activate colliders
|
||||
collision_layer = 1
|
||||
z_index = 10
|
||||
modulate = Color.WHITE
|
||||
pass
|
||||
|
|
@ -55,4 +55,5 @@ func become_real():
|
|||
func become_fake():
|
||||
z_index = 0
|
||||
modulate = Color.DIM_GRAY
|
||||
collision_layer = 2
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ joint_mode = 2
|
|||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("temp_segment")]
|
||||
[node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("temp_segment", "snake_line")]
|
||||
zoom = Vector2(0.05, 0.05)
|
||||
script = ExtResource("5_ykrsh")
|
||||
temp_segment = NodePath("../Snake/SegementHolder/SnakeSegment")
|
||||
snake_line = NodePath("../Snake/Line2D")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue