diff --git a/.DS_Store b/.DS_Store index d9e6ac5..b90f045 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000..79ff83a Binary files /dev/null and b/assets/.DS_Store differ diff --git a/game.gd b/game.gd index 2e63c7f..0f61f6f 100644 --- a/game.gd +++ b/game.gd @@ -14,13 +14,18 @@ var _sequence = [] @onready var diceSprite = $GUI/DiceSprite as Sprite2D @onready var player1Sprite = $GUI/Player1Sprite as Sprite2D @onready var player2Sprite = $GUI/Player2Sprite as Sprite2D +@onready var ereignis = $GUI/Event as Label +@onready var sequenz = $GUI/Sequenz as Label # Called when the node enters the scene tree for the first time. func _ready(): current_player = 0 + sequence_needed = 4 board.reset() won = "" + ereignis.text = "Ereignis: " + sequenz.text = "Steine zum gewinnen: 4" wonPlayer.hide() nextPlayer.region_rect.position.x = current_player * 300 nextPlayer.show() @@ -95,9 +100,9 @@ func _roll_dice() -> int: animation_help = zahl_davor await get_tree().create_timer(0.25).timeout - _update_dice_sprite(zahl) - print(zahl) #Debug ausgabe, später löschen lol + print(zahl) #Debug ausgabe, später löschen + return zahl @@ -166,30 +171,40 @@ func _instant_win(): #Zum Testen der Events func _on_test_pressed(): - board.delete_column(6) + ereignis.text += "test" func _spin_the_wheel(result: int) -> void: - if result <= 5: + ereignis.text = "Ereignis: " + if result <= 3: + ereignis.text += "Instant win!" _instant_win() elif result <= 15: - print("1 ding löschen")#Debug + 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() elif result <= 45: - _five_wins() + if sequence_needed == 5: + print("lol") + _spin_the_wheel(randi() % 100 + 1) + else: + ereignis.text += "Ab jetzt gilt 5 - Gewinnt!" + sequenz.text = "Steine zum gewinnen: 5" + _five_wins() elif result <= 65: var zeile_zum_loeschen = randi() % 6 + 1 - print("delete column"+ zeile_zum_loeschen)#Debug + ereignis.text += "Zeile " + str(zeile_zum_loeschen) + " wird entfernt!" board.delete_column(zeile_zum_loeschen) elif result <= 85: var spalte_zum_loeschen = randi() % 6 + 1 - print("delete row" + spalte_zum_loeschen)#Debug + ereignis.text += "Spalte " + str(spalte_zum_loeschen) + " wird entfernt!" board.delete_row(spalte_zum_loeschen) elif result <= 100: + ereignis.text += str(result) print("größer als 85")#Debug diff --git a/game.tscn b/game.tscn index 5a63ac3..bb2e98e 100644 --- a/game.tscn +++ b/game.tscn @@ -24,10 +24,9 @@ offset_right = 1215.0 offset_bottom = 74.0 theme_override_font_sizes/font_size = 40 text = "Tic Tac Toe Extreme" -metadata/_edit_use_anchors_ = true [node name="NextPlayer" type="Sprite2D" parent="GUI"] -position = Vector2(1107.63, 239.75) +position = Vector2(1112, 240) scale = Vector2(1.0075, 0.995) texture = ExtResource("3_0333r") region_enabled = true @@ -41,10 +40,9 @@ offset_bottom = 277.5 size_flags_horizontal = 4 theme_override_font_sizes/font_size = 45 text = "Next:" -metadata/_edit_use_anchors_ = true [node name="WonPlayer" type="Sprite2D" parent="GUI"] -position = Vector2(1106, 341.5) +position = Vector2(1112, 336) scale = Vector2(0.999999, 0.995) texture = ExtResource("3_0333r") region_enabled = true @@ -58,10 +56,9 @@ offset_bottom = 378.5 size_flags_horizontal = 4 theme_override_font_sizes/font_size = 45 text = "Winner:" -metadata/_edit_use_anchors_ = true [node name="DiceSprite" type="Sprite2D" parent="GUI"] -position = Vector2(1197, 538) +position = Vector2(1198, 498) scale = Vector2(1.26596, 1.2191) texture = ExtResource("3_0333r") region_enabled = true @@ -69,36 +66,36 @@ region_rect = Rect2(207, 410, 85, 85) [node name="RestartButton" type="Button" parent="GUI"] offset_left = 866.0 -offset_top = 707.0 -offset_right = 1095.0 -offset_bottom = 827.0 +offset_top = 712.0 +offset_right = 1096.0 +offset_bottom = 832.0 theme_override_colors/font_color = Color(1, 0, 0, 1) theme_override_font_sizes/font_size = 30 text = "Restart" -metadata/_edit_use_anchors_ = true [node name="DiceButton" type="Button" parent="GUI"] -offset_left = 865.0 -offset_top = 480.0 +offset_left = 866.0 +offset_top = 440.0 offset_right = 1097.0 -offset_bottom = 600.0 +offset_bottom = 560.0 theme_override_font_sizes/font_size = 30 text = "Würfeln" -metadata/_edit_use_anchors_ = true [node name="Test" type="Button" parent="GUI"] -offset_left = 872.0 -offset_top = 605.0 -offset_right = 1096.0 -offset_bottom = 701.0 +offset_left = 1184.0 +offset_top = 640.0 +offset_right = 1416.0 +offset_bottom = 736.0 +rotation = 0.000312189 theme_override_font_sizes/font_size = 35 text = "Test" [node name="Spin the Wheel" type="Button" parent="GUI"] -offset_left = 1395.0 -offset_top = 691.0 -offset_right = 1710.0 -offset_bottom = 835.0 +offset_left = 866.0 +offset_top = 576.0 +offset_right = 1096.0 +offset_bottom = 696.0 +theme_override_font_sizes/font_size = 25 text = "Spin the Wheel" [node name="Player1Label" type="Label" parent="GUI"] @@ -108,7 +105,6 @@ offset_right = 350.0 offset_bottom = 108.0 theme_override_font_sizes/font_size = 45 text = "Player 1:" -metadata/_edit_use_anchors_ = true [node name="Player1Sprite" type="Sprite2D" parent="GUI"] position = Vector2(403, 79.1) @@ -124,7 +120,6 @@ offset_right = 684.0 offset_bottom = 108.1 theme_override_font_sizes/font_size = 45 text = "Player 2:" -metadata/_edit_use_anchors_ = true [node name="Player2Sprite" type="Sprite2D" parent="GUI"] position = Vector2(735.388, 78.0625) @@ -133,6 +128,22 @@ texture = ExtResource("3_0333r") region_enabled = true region_rect = Rect2(307, 108, 86, 86) +[node name="Event" type="Label" parent="GUI"] +offset_left = 312.0 +offset_top = 888.0 +offset_right = 517.0 +offset_bottom = 957.0 +theme_override_font_sizes/font_size = 50 +text = "Ereignis:" + +[node name="Sequenz" type="Label" parent="GUI"] +offset_left = 1256.0 +offset_top = 310.0 +offset_right = 2050.0 +offset_bottom = 379.0 +theme_override_font_sizes/font_size = 50 +text = "Steine zum gewinnen: " + [connection signal="pressed" from="GUI/RestartButton" to="." method="_on_restart_button_pressed"] [connection signal="pressed" from="GUI/DiceButton" to="." method="_on_dice_button_pressed"] [connection signal="pressed" from="GUI/Test" to="." method="_on_test_pressed"] diff --git a/schnick.tscn b/schnick.tscn new file mode 100644 index 0000000..b90d0da --- /dev/null +++ b/schnick.tscn @@ -0,0 +1,18 @@ +[gd_scene format=3 uid="uid://da75wsdk40fp4"] + +[node name="Schnick" type="Window"] +title = "Schere, Stein, Papier!" +initial_position = 1 +size = Vector2i(1500, 1000) + +[node name="Label" type="Label" parent="."] +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 49.0 +grow_horizontal = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +theme_override_font_sizes/font_size = 50 +text = "Du hast eine eins gewürfelt. + Was wählst du nun: Schere, Stein oder Papier?" +horizontal_alignment = 1