diff --git a/board/board.gd b/board/board.gd index 8b3f7a2..7398e23 100644 --- a/board/board.gd +++ b/board/board.gd @@ -76,3 +76,30 @@ func _calculate_drop_pos(grid_pos: Vector2) -> Vector2: else: i = i - 1 return Vector2(x_coord, y_coord) + +#Löscht eine Zeile nach dem Glücksrad ereignis +func delete_column(column: int) -> void: + for j in range((column - 2), -1, -1): + for i in range(-2, 4, 1): + var tile_map_layer = 1 + var tile_map_cell_position = Vector2i(i,j) + var tile_data = self.get_cell_tile_data(tile_map_layer, tile_map_cell_position) + if tile_data: + var tile_map_cell_source_id = self.get_cell_source_id(tile_map_layer, tile_map_cell_position); + var tile_map_cell_atlas_coords = self.get_cell_atlas_coords(tile_map_layer, tile_map_cell_position) + var tile_map_cell_alternative = self.get_cell_alternative_tile(tile_map_layer, tile_map_cell_position) + var new_tile_map_cell_position = Vector2i(i, j + 1) + self.set_cell(tile_map_layer, new_tile_map_cell_position, tile_map_cell_source_id, tile_map_cell_atlas_coords, tile_map_cell_alternative) + else: + #Falls kein Inhalt, leer setzten + self.set_cell(tile_map_layer, Vector2i(i, j + 1)) + +func delete_row(row: int) -> void: + var tile_map_layer = 1 + for i in range(6): + #Inhalt leer setzten + self.set_cell(tile_map_layer, Vector2i(row - 2, i)) + + + + diff --git a/game.gd b/game.gd index ac0aeaf..409e8d0 100644 --- a/game.gd +++ b/game.gd @@ -3,6 +3,7 @@ extends Node2D var current_player: int = 0 var player_states := ["Circle", "Cross"] var won := "" +var count = 0 @onready var board := $Board as Board @@ -33,6 +34,7 @@ func _process(_delta): var new_pos = board._calculate_drop_pos(grid_pos) if board.set_state(new_pos, player_states[current_player]): won = _check_win() + #count = count + 1 if won=="": current_player = 1 - current_player nextPlayer.region_rect.position.x = current_player * 300 @@ -42,6 +44,8 @@ func _process(_delta): wonPlayer.show() nextPlayer.hide() board.active = false + #if count > 7: + #board.delete_row(5) zum testen des entfernens diff --git a/project.godot b/project.godot index d6d8123..32832e0 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,7 @@ config/icon="res://icon.svg" window/size/viewport_width=1500 window/size/viewport_height=1000 +window/size/mode=2 [input]