cooking
This commit is contained in:
parent
f0f173ee06
commit
23b21cefbb
3 changed files with 14 additions and 4 deletions
|
|
@ -17,8 +17,9 @@ func _process(delta: float) -> void:
|
||||||
target = temp_segment
|
target = temp_segment
|
||||||
|
|
||||||
if target:
|
if target:
|
||||||
position = lerp(position, target.position, 0.1 * delta)
|
# TODO FIX
|
||||||
zoom = lerp(zoom, Vector2(1,1),0.1 * delta)
|
position = lerp(position, target.position, 0.6 * delta)
|
||||||
|
zoom = lerp(zoom, Vector2(1,1),0.6 * delta)
|
||||||
else:
|
else:
|
||||||
position = Vector2(0,0)
|
position = Vector2(0,0)
|
||||||
zoom = Vector2(0.05,0.05)
|
zoom = Vector2(0.05,0.05)
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,14 @@ func _ready() -> void:
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
move_progress += delta * snake_speed
|
move_progress += delta * snake_speed
|
||||||
if Input.get_vector("left","right","up","down").length() > 0:
|
if Input.is_action_just_pressed("left"):
|
||||||
want_direction = Input.get_vector("left","right","up","down")
|
want_direction = Vector2.LEFT
|
||||||
|
elif Input.is_action_just_pressed("right"):
|
||||||
|
want_direction = Vector2.RIGHT
|
||||||
|
elif Input.is_action_just_pressed("up"):
|
||||||
|
want_direction = Vector2.UP
|
||||||
|
elif Input.is_action_just_pressed("down"):
|
||||||
|
want_direction = Vector2.DOWN
|
||||||
position = lerp(start_pos,target_pos,move_progress)
|
position = lerp(start_pos,target_pos,move_progress)
|
||||||
if move_progress >= 1:
|
if move_progress >= 1:
|
||||||
get_new_target()
|
get_new_target()
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ next_segment = NodePath("../SnakeSegment2")
|
||||||
[node name="Line2D" type="Line2D" parent="Snake"]
|
[node name="Line2D" type="Line2D" parent="Snake"]
|
||||||
width = 320.0
|
width = 320.0
|
||||||
default_color = Color(0, 0.662728, 1.54018e-06, 1)
|
default_color = Color(0, 0.662728, 1.54018e-06, 1)
|
||||||
|
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")]
|
||||||
zoom = Vector2(0.05, 0.05)
|
zoom = Vector2(0.05, 0.05)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue