v.0.5.7.2 clear enemy tile gefixt

main
Daniel Lehmann 2024-03-30 19:56:03 +01:00
parent cf02a54230
commit 68c53cd7cf
2 changed files with 9 additions and 6 deletions

View File

@ -106,7 +106,7 @@ func delete_row(row: int) -> void:
func _clear_enemy_tile(grid_pos: Vector2) -> void:
var true_position = grid_pos + Vector2(-2, 0) #Minus 2 weil über einen Klick und nicht über einen Würfel
var true_position = grid_pos
self.set_cell(tile_map_layer, true_position)
for i in range(true_position.y - 1, -1, -1 ):
var tile_map_cell_position = Vector2i(true_position.x, i)

13
game.gd
View File

@ -5,6 +5,7 @@ var player_states := ["Circle", "Cross"]
var won := ""
var sequence_needed = 4
var _sequence = []
var enable_remove = true
@onready var board := $Board as Board
@ -38,7 +39,11 @@ func _process(_delta):
if won == "":
if Input.is_action_just_pressed("Click"):
var grid_pos = board.gridpos_at_mouse()
if board.get_state(Vector2(grid_pos.x, 0)) == board.empty_state:
if enable_remove:
print(grid_pos)
board._clear_enemy_tile(grid_pos)
enable_remove = false
elif board.get_state(Vector2(grid_pos.x, 0)) == board.empty_state:
var new_pos = board._calculate_drop_pos(grid_pos)
if board.set_state(new_pos, player_states[current_player]):
won = _check_win()
@ -180,7 +185,7 @@ func _instant_loose():
#Zum Testen der Events
func _on_test_pressed():
_instant_loose()
_spin_the_wheel(15)
ereignis.text += "test"
@ -193,10 +198,8 @@ func _spin_the_wheel(result: int) -> void:
ereignis.text += "Instant loose!"
_instant_loose()
elif result <= 15:
enable_remove = true
ereignis.text += "Du darfst einen Stein entfernen!"
if Input.is_action_just_pressed("Click"):
var grid_pos = board.gridpos_at_mouse()
board._clear_enemy_tile(grid_pos)
elif result <= 30:
ereignis.text += "Symboltausch!"
_change_symbols()