fix: Frog jumps on harmful if its also food for him
This commit is contained in:
parent
bf802571a2
commit
44b6cbf379
@ -257,7 +257,7 @@ cast_to = Vector2( 0, -1 )
|
|||||||
collision_mask = 56
|
collision_mask = 56
|
||||||
collide_with_areas = true
|
collide_with_areas = true
|
||||||
|
|
||||||
[node name="EnemyBody" type="CollisionShape2D" parent="." groups=["harmful"]]
|
[node name="EnemyBody" type="CollisionShape2D" parent="." groups=["frogfood", "harmful"]]
|
||||||
position = Vector2( 0, -0.5 )
|
position = Vector2( 0, -0.5 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
|||||||
@ -517,6 +517,7 @@ func is_jump_path_safe(v: Vector2, pos: Vector2) -> bool:
|
|||||||
abs(node_pos.x - pos.x) > abs(jump_distance) * 3
|
abs(node_pos.x - pos.x) > abs(jump_distance) * 3
|
||||||
|| abs(node_pos.y - pos.y) > block_size * 4
|
|| abs(node_pos.y - pos.y) > block_size * 4
|
||||||
|| abs(node_pos.x - pos.x) < 1
|
|| abs(node_pos.x - pos.x) < 1
|
||||||
|
|| node.is_in_group("frogfood")
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
var node_y = node_pos.y - block_size / 2.0
|
var node_y = node_pos.y - block_size / 2.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user