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
|
||||
|
||||
if target:
|
||||
position = lerp(position, target.position, 0.1 * delta)
|
||||
zoom = lerp(zoom, Vector2(1,1),0.1 * delta)
|
||||
# TODO FIX
|
||||
position = lerp(position, target.position, 0.6 * delta)
|
||||
zoom = lerp(zoom, Vector2(1,1),0.6 * delta)
|
||||
else:
|
||||
position = Vector2(0,0)
|
||||
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.
|
||||
func _process(delta: float) -> void:
|
||||
move_progress += delta * snake_speed
|
||||
if Input.get_vector("left","right","up","down").length() > 0:
|
||||
want_direction = Input.get_vector("left","right","up","down")
|
||||
if Input.is_action_just_pressed("left"):
|
||||
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)
|
||||
if move_progress >= 1:
|
||||
get_new_target()
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ next_segment = NodePath("../SnakeSegment2")
|
|||
[node name="Line2D" type="Line2D" parent="Snake"]
|
||||
width = 320.0
|
||||
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")]
|
||||
zoom = Vector2(0.05, 0.05)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue