diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-04-27 20:06:49 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-04-27 20:06:49 +0200 |
commit | 81cc6f1d22677dd4a60aa9377c91b291bf10e523 (patch) | |
tree | 9c22712a9746ed0598a44be6e88727d021436860 /Scenes/Entities/Player.gd | |
parent | c8a316e4b8987dad963656a34665fa0e23dedcb1 (diff) |
update
Diffstat (limited to 'Scenes/Entities/Player.gd')
-rw-r--r-- | Scenes/Entities/Player.gd | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/Scenes/Entities/Player.gd b/Scenes/Entities/Player.gd index 1994b75..ba404fe 100644 --- a/Scenes/Entities/Player.gd +++ b/Scenes/Entities/Player.gd @@ -14,7 +14,10 @@ const THROW_DISTANCE = 3 @export var BombScene: PackedScene = preload("res://Scenes/Entities/Bombs/Bomb__Normal.tscn") @export var bomb_power: int = 2 @export var max_bombs: int = 5 -@export var bomb_components: Array[Bomb.COMPONENT_TYPE] = [] +@export var bomb_components: Array[Bomb.COMPONENT_TYPE] = [ + Bomb.COMPONENT_TYPE.REMOTE_CONTROL, + Bomb.COMPONENT_TYPE.REMOTE_DETONATE +] var bombs: Array = [] var last_planted_bomb: Bomb @@ -43,6 +46,7 @@ func _ready(): motion_mode = CharacterBody2D.MOTION_MODE_FLOATING collision_area = Utilities.Collision.Area.new(self, $CollisionShape2D) + collision_area.set_collision_mask_value(Utilities.Collision.Layer.ENEMY, true) collision_area.connect("collided", Callable(self, "_collide")) add_child(collision_area) @@ -129,21 +133,20 @@ func _process(delta): self.LAST_DIRECTIONS = self.DIRECTIONS if Input.is_action_just_pressed("ui_accept"): - if not self.is_in_interaction_area(): - if self.held_bomb: - self.throw_bomb() - else: - var interacted = false - var bomb = self.has_pickable_bomb() - if bomb: - self.pick_up_bomb(bomb) - interacted = true - - if not interacted: - if self.can_plant_bomb(): - self.plant_bomb() - self.just_planted_bomb = true - #$JustPlantedBomb.start() + if self.held_bomb: + self.throw_bomb() + else: + var interacted = false + var bomb = self.has_pickable_bomb() + if bomb: + self.pick_up_bomb(bomb) + interacted = true + + if not interacted: + if self.can_plant_bomb(): + self.plant_bomb() + self.just_planted_bomb = true + #$JustPlantedBomb.start() #self.collide(move_and_collide(velocity * delta)) move_and_slide() @@ -153,7 +156,11 @@ func _process(delta): func can_plant_bomb(): - return self.bombs.size() < self.max_bombs + return ( + self.bombs.size() < self.max_bombs + and not Utilities.has_dialog + and Global.last_area.can_plant_bomb + ) func plant_bomb(): |