Skip to content

Commit

Permalink
Fix bug with pheromone laying; improve player break speed; fix bug wh…
Browse files Browse the repository at this point in the history
…ere we could try to check if a non-ant entity is dead
  • Loading branch information
diogoalmeida committed Nov 25, 2021
1 parent 2090be0 commit 239ad00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions entities/npc_ant_controller.gd
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@ func _on_interaction_field_area_entered(area):
_limit_direction_flip = false

func is_enemy(body):
return (
not body.is_dead() and
(
body.is_in_group("enemy_npc_ants") and self.is_in_group("npc_ants") or
(body.is_in_group("npc_ants") or body.is_in_group("player")) and self.is_in_group("enemy_npc_ants")
if body.has_method("is_dead"):
return (
not body.is_dead() and
(
body.is_in_group("enemy_npc_ants") and self.is_in_group("npc_ants") or
(body.is_in_group("npc_ants") or body.is_in_group("player")) and self.is_in_group("enemy_npc_ants")
)
)
)
return false

func _body_entered_interaction_field(body):
if _current_state != State.WALKING and _current_state != State.IDLE:
Expand Down
2 changes: 1 addition & 1 deletion entities/player_ant.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func _handle_pheromone():
if pheromone_map == null:
return

if OS.is_debug_build() && Input.is_action_just_pressed("pheromone_toggle_key"):
if Input.is_action_just_pressed("pheromone_toggle_key"):
_toggle_pheromone_mode()

if Input.is_action_pressed("pheromone_action_key"):
Expand Down
2 changes: 1 addition & 1 deletion entities/player_ant.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ script = ExtResource( 3 )
[node name="base_ant" parent="." groups=["player"] instance=ExtResource( 1 )]
script = ExtResource( 2 )
speed = 75
break_speed = 10
break_speed = 20
tool_point = Vector2( 0, -25 )

[node name="interaction_field" parent="base_ant" index="1"]
Expand Down

0 comments on commit 239ad00

Please sign in to comment.