Fixed move penalty
This commit is contained in:
parent
e7baa34859
commit
b42b1ae39f
3 changed files with 37 additions and 9 deletions
19
Tile/Tile.gd
19
Tile/Tile.gd
|
|
@ -103,6 +103,7 @@ func _ready() -> void:
|
|||
GameEvents.insect_action_cancelled.connect(_on_action_cancelled)
|
||||
|
||||
GameEvents.turn_started.connect(_on_turn_started)
|
||||
GameEvents.turn_ended.connect(_on_turn_ended)
|
||||
|
||||
func _on_action_cancelled() -> void:
|
||||
selected_for_action = false
|
||||
|
|
@ -124,18 +125,22 @@ func _on_selection_failed(tile: InsectTile) -> void:
|
|||
|
||||
# Show selection failed mat
|
||||
|
||||
func _on_turn_started(turn_num: int, map: HexGrid, _is_blacks_turn: bool) -> void:
|
||||
is_blacks_turn = _is_blacks_turn
|
||||
|
||||
move_round_penalty -= 1
|
||||
func _on_turn_ended(turn_num: int, map: HexGrid) -> void:
|
||||
move_round_penalty = move_round_penalty - 1
|
||||
if move_round_penalty < 0:
|
||||
move_round_penalty = 0
|
||||
|
||||
func _on_turn_started(turn_num: int, map: HexGrid, _is_blacks_turn: bool) -> void:
|
||||
is_blacks_turn = _is_blacks_turn
|
||||
|
||||
can_be_selected = GameData.bees_placed.has(is_black)
|
||||
#print(GameData.has_bee_been_placed)
|
||||
if turn_num >= 7 and not GameData.bees_placed.has(is_black):
|
||||
can_be_selected = false
|
||||
|
||||
if not can_move():
|
||||
can_be_selected = false
|
||||
|
||||
if can_be_selected:
|
||||
tween_normal()
|
||||
else:
|
||||
|
|
@ -172,7 +177,7 @@ func _on_insect_tile_moved(tile: InsectTile, to: Vector4i) -> void:
|
|||
action_callback = Callable()
|
||||
|
||||
if tile == self:
|
||||
move_round_penalty == 2
|
||||
move_round_penalty = 1
|
||||
|
||||
func _on_insect_tile_deselected(tile: InsectTile) -> void:
|
||||
selected = false
|
||||
|
|
@ -212,7 +217,6 @@ func _on_insect_placement_cancelled() -> void:
|
|||
else:
|
||||
tween_disabled()
|
||||
|
||||
|
||||
func _on_insect_selected(button: InsectButton, is_black: bool) -> void:
|
||||
deactivated = true
|
||||
|
||||
|
|
@ -229,6 +233,9 @@ func _input_event(camera, event, position, normal, shape_idx):
|
|||
if not can_be_selected:
|
||||
return
|
||||
|
||||
if not can_move():
|
||||
return
|
||||
|
||||
#if not hovered:
|
||||
#return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue