v.0.6: GUI Update

- GUI verschönert (ist immernoch bisschen hässlich tho)
- Ab Runde 2 muss der Spieler jetzt würfeln vor seinem Zug
main
Ileyan Al Jaaf 2024-03-30 23:18:46 +01:00
parent 03f607158a
commit 376dade17c
2 changed files with 73 additions and 57 deletions

15
game.gd
View File

@ -6,6 +6,8 @@ var won := ""
var sequence_needed = 4
var _sequence = []
var enable_remove = true
var move_allowed = true
var zuege = 0
@onready var gui := $GUI as Node2D
@onready var board := $Board as Board
@ -38,7 +40,7 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
if won == "":
if Input.is_action_just_pressed("Click"):
if Input.is_action_just_pressed("Click") and move_allowed:
var grid_pos = board.gridpos_at_mouse()
if enable_remove:
print(grid_pos)
@ -47,6 +49,9 @@ func _process(_delta):
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]):
if zuege >= 1:
move_allowed = false #Damit vor jedem Zug gewürfelt wird (Ab Runde 2)
zuege += 1
won = _check_win()
if won=="":
switch_player()
@ -63,6 +68,7 @@ func _process(_delta):
nextPlayer.hide()
board.active = false
func switch_player():
current_player = 1 - current_player
nextPlayer.region_rect.position.x = current_player * 300
@ -113,12 +119,15 @@ func _roll_dice() -> int:
if zahl == 1:
switch_to_schnick()
if zahl == 6:
move_allowed = false
return zahl
#Funktion um Knopf und Methode zu verbinden
func _on_dice_button_pressed():
move_allowed = true
_roll_dice()
@ -195,6 +204,7 @@ func _on_test_pressed():
func _spin_the_wheel(result: int) -> void:
move_allowed = true
ereignis.text = "Ereignis: "
if result <= 3:
ereignis.text += "Instant win!"
@ -236,14 +246,17 @@ func _on_spin_the_wheel_pressed():
func hide_schnick():
schnick.hide()
move_allowed = true
func switch_to_schnick():
move_allowed = false
board.hide()
numbers.hide()
gui.hide()
schnick.show()
func switch_to_game():
move_allowed = true
gui.show()
numbers.show()
board.show()

115
game.tscn
View File

@ -11,139 +11,142 @@
script = ExtResource("1_g1ie7")
[node name="Numbers" parent="." instance=ExtResource("1_ym80r")]
position = Vector2(375, 232)
position = Vector2(878, 280)
layer_0/tile_data = PackedInt32Array(65533, 1, 3, 131069, 65537, 3, 196605, 131073, 3, 262141, 196609, 3, 327677, 65537, 4, 393213, 131073, 4, -2, 1, 3, -1, 65537, 3, -65536, 131073, 3, -65535, 196609, 3, -65534, 65537, 4, -65533, 131073, 4)
[node name="Board" parent="." instance=ExtResource("1_ym80r")]
position = Vector2(375, 232)
position = Vector2(879, 280)
layer_0/tile_data = PackedInt32Array(65537, 1, 0, 131073, 1, 0, 131074, 1, 0, 0, 1, 0, 65536, 1, 0, 131072, 1, 0, 1, 1, 0, 2, 1, 0, 65538, 1, 0, 65534, 1, 0, 131070, 1, 0, 131071, 1, 0, 196607, 1, 0, 65535, 1, 0, 196606, 1, 0, 262142, 1, 0, 327678, 1, 0, 393214, 1, 0, 393215, 1, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 262147, 1, 0, 196611, 1, 0, 131075, 1, 0, 65539, 1, 0, 3, 1, 0, 196610, 1, 0, 262146, 1, 0, 262145, 1, 0, 196609, 1, 0, 262144, 1, 0, 196608, 1, 0, 327679, 1, 0, 262143, 1, 0)
[node name="GUI" type="Node2D" parent="."]
[node name="Title" type="Label" parent="GUI"]
offset_left = 834.0
offset_top = 2.0
offset_right = 1215.0
offset_bottom = 74.0
theme_override_font_sizes/font_size = 40
offset_left = 715.0
offset_top = 70.0
offset_right = 1195.0
offset_bottom = 142.0
size_flags_horizontal = 4
theme_override_colors/font_shadow_color = Color(0.278431, 0.537255, 0.870588, 1)
theme_override_font_sizes/font_size = 50
text = "Tic Tac Toe Extreme"
horizontal_alignment = 1
[node name="NextPlayer" type="Sprite2D" parent="GUI"]
position = Vector2(1112, 240)
position = Vector2(1528, 343.75)
scale = Vector2(1.0075, 0.995)
texture = ExtResource("3_0333r")
region_enabled = true
region_rect = Rect2(0, 100, 100, 100)
[node name="NextPlayerLabel" type="Label" parent="GUI"]
offset_left = 875.0
offset_top = 208.5
offset_right = 1005.0
offset_bottom = 277.5
offset_left = 1351.0
offset_top = 312.0
offset_right = 1481.0
offset_bottom = 381.0
size_flags_horizontal = 4
theme_override_font_sizes/font_size = 45
text = "Next:"
[node name="WonPlayer" type="Sprite2D" parent="GUI"]
position = Vector2(1112, 336)
position = Vector2(1840, 343.75)
scale = Vector2(0.999999, 0.995)
texture = ExtResource("3_0333r")
region_enabled = true
region_rect = Rect2(0, 100, 100, 100)
[node name="WonPlayerLabel" type="Label" parent="GUI"]
offset_left = 877.0
offset_top = 309.5
offset_right = 1048.0
offset_bottom = 378.5
offset_left = 1605.0
offset_top = 311.75
offset_right = 1776.0
offset_bottom = 380.75
size_flags_horizontal = 4
theme_override_font_sizes/font_size = 45
text = "Winner:"
[node name="DiceSprite" type="Sprite2D" parent="GUI"]
position = Vector2(1198, 498)
position = Vector2(1694, 488)
scale = Vector2(1.26596, 1.2191)
texture = ExtResource("3_0333r")
region_enabled = true
region_rect = Rect2(207, 410, 85, 85)
[node name="RestartButton" type="Button" parent="GUI"]
offset_left = 866.0
offset_top = 712.0
offset_right = 1096.0
offset_bottom = 832.0
offset_left = 1351.0
offset_top = 752.0
offset_right = 1581.0
offset_bottom = 872.0
theme_override_colors/font_color = Color(1, 0, 0, 1)
theme_override_font_sizes/font_size = 30
text = "Restart"
[node name="DiceButton" type="Button" parent="GUI"]
offset_left = 866.0
offset_top = 440.0
offset_right = 1097.0
offset_bottom = 560.0
offset_left = 1351.0
offset_top = 432.0
offset_right = 1582.0
offset_bottom = 552.0
theme_override_font_sizes/font_size = 30
text = "Würfeln"
[node name="Test" type="Button" parent="GUI"]
offset_left = 1184.0
offset_top = 640.0
offset_right = 1416.0
offset_bottom = 736.0
offset_left = 1640.0
offset_top = 765.0
offset_right = 1872.0
offset_bottom = 861.0
rotation = 0.000312189
theme_override_font_sizes/font_size = 35
text = "Test"
[node name="Spin the Wheel" type="Button" parent="GUI"]
offset_left = 866.0
offset_top = 576.0
offset_right = 1096.0
offset_bottom = 696.0
offset_left = 1351.0
offset_top = 592.0
offset_right = 1581.0
offset_bottom = 712.0
theme_override_font_sizes/font_size = 25
text = "Spin the Wheel"
[node name="Player1Label" type="Label" parent="GUI"]
offset_left = 164.0
offset_top = 45.0
offset_right = 350.0
offset_bottom = 108.0
theme_override_font_sizes/font_size = 45
offset_left = 82.0
offset_top = 473.15
offset_right = 331.0
offset_bottom = 556.15
theme_override_font_sizes/font_size = 60
text = "Player 1:"
[node name="Player1Sprite" type="Sprite2D" parent="GUI"]
position = Vector2(403, 79.1)
scale = Vector2(0.767647, 0.709302)
position = Vector2(412, 518.15)
scale = Vector2(1.137, 1.05)
texture = ExtResource("3_0333r")
region_enabled = true
region_rect = Rect2(8, 108, 85, 86)
[node name="Player2Label" type="Label" parent="GUI"]
offset_left = 498.0
offset_top = 45.1
offset_right = 684.0
offset_bottom = 108.1
theme_override_font_sizes/font_size = 45
offset_left = 82.0
offset_top = 629.3
offset_right = 331.0
offset_bottom = 712.3
theme_override_font_sizes/font_size = 60
text = "Player 2:"
[node name="Player2Sprite" type="Sprite2D" parent="GUI"]
position = Vector2(735.388, 78.0625)
scale = Vector2(0.688662, 0.696221)
position = Vector2(412, 662.3)
scale = Vector2(1.04, 1.05)
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
offset_left = 573.0
offset_top = 909.0
offset_right = 778.0
offset_bottom = 978.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
offset_left = 20.0
offset_top = 199.0
offset_right = 814.0
offset_bottom = 268.0
theme_override_font_sizes/font_size = 50
text = "Steine zum gewinnen: "