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
|
|
@ -9,10 +9,11 @@ radius = 16.0
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_q1ksn"]
|
||||
radius = 7.07107
|
||||
|
||||
[node name="Braincell" type="CharacterBody2D"]
|
||||
[node name="Braincell" type="CharacterBody2D" node_paths=PackedStringArray("doorBox")]
|
||||
z_index = 15
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_q1ksn")
|
||||
doorBox = NodePath("doorBox")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_wv6rk")
|
||||
|
|
|
|||
|
|
@ -21,19 +21,21 @@ func _ready() -> void:
|
|||
target_pos = position
|
||||
start_pos = position
|
||||
get_new_target()
|
||||
become_real()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
move_progress += delta * snake_speed
|
||||
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
|
||||
if(!Router.player_mode):
|
||||
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()
|
||||
|
|
@ -55,7 +57,7 @@ func become_real():
|
|||
pass
|
||||
|
||||
func become_fake():
|
||||
z_index = 0
|
||||
modulate = Color.DIM_GRAY
|
||||
collision_layer = 2
|
||||
#z_index = 0
|
||||
#modulate = Color.DIM_GRAY
|
||||
#collision_layer = 2
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://cay1k1dp8yf12" path="res://assets/door.png" id="4_34t3n"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_08kyq"]
|
||||
size = Vector2(16, 64)
|
||||
size = Vector2(8, 64)
|
||||
|
||||
[node name="SnakeSegment" type="AnimatableBody2D" node_paths=PackedStringArray("door")]
|
||||
script = ExtResource("1_3ulhv")
|
||||
|
|
@ -36,7 +36,7 @@ position = Vector2(160, 0)
|
|||
position = Vector2(-22, 0)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DoorArm/Door/DoorIn"]
|
||||
position = Vector2(14, 0)
|
||||
position = Vector2(10, 0)
|
||||
shape = SubResource("RectangleShape2D_08kyq")
|
||||
|
||||
[node name="DoorOut" type="Area2D" parent="DoorArm/Door"]
|
||||
|
|
@ -44,7 +44,7 @@ position = Vector2(22, 0)
|
|||
rotation = 3.14159
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DoorArm/Door/DoorOut"]
|
||||
position = Vector2(14, 3.54925e-05)
|
||||
position = Vector2(10, 2.53518e-05)
|
||||
shape = SubResource("RectangleShape2D_08kyq")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="DoorArm/Door"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue