v.0.5.2: Test button hinzugefügt
parent
7084d586a8
commit
8ae0289271
9
game.gd
9
game.gd
|
@ -31,7 +31,7 @@ func _process(_delta):
|
||||||
if won == "":
|
if won == "":
|
||||||
if Input.is_action_just_pressed("Click"):
|
if Input.is_action_just_pressed("Click"):
|
||||||
var grid_pos = board.gridpos_at_mouse()
|
var grid_pos = board.gridpos_at_mouse()
|
||||||
if board.get_state(grid_pos) == board.empty_state:
|
if board.get_state(Vector2(grid_pos.x, 0)) == board.empty_state:
|
||||||
var new_pos = board._calculate_drop_pos(grid_pos)
|
var new_pos = board._calculate_drop_pos(grid_pos)
|
||||||
if board.set_state(new_pos, player_states[current_player]):
|
if board.set_state(new_pos, player_states[current_player]):
|
||||||
won = _check_win()
|
won = _check_win()
|
||||||
|
@ -101,7 +101,7 @@ func _roll_dice():
|
||||||
return zahl
|
return zahl
|
||||||
|
|
||||||
|
|
||||||
#Funktion um Knop und Methode zu verbinden
|
#Funktion um Knopf und Methode zu verbinden
|
||||||
func _on_dice_button_pressed():
|
func _on_dice_button_pressed():
|
||||||
_roll_dice()
|
_roll_dice()
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ func _get_dice_pos_y(result: int) -> int:
|
||||||
|
|
||||||
#Nach dem Glücksradereignis wird die Siegesbedingung auf 5 gewinnt geändert
|
#Nach dem Glücksradereignis wird die Siegesbedingung auf 5 gewinnt geändert
|
||||||
func _five_wins() -> void:
|
func _five_wins() -> void:
|
||||||
|
print("5 Gewinnt aktiv") #Debug
|
||||||
five_wins = true
|
five_wins = true
|
||||||
|
|
||||||
#Nach dem Glücksradereignis tauschen die Spieler die Symbole
|
#Nach dem Glücksradereignis tauschen die Spieler die Symbole
|
||||||
|
@ -152,3 +153,7 @@ func _instant_win():
|
||||||
wonPlayer.show()
|
wonPlayer.show()
|
||||||
nextPlayer.hide()
|
nextPlayer.hide()
|
||||||
board.active = false
|
board.active = false
|
||||||
|
|
||||||
|
#Zum Testen der Events
|
||||||
|
func _on_test_pressed():
|
||||||
|
_five_wins()
|
||||||
|
|
|
@ -84,5 +84,14 @@ offset_bottom = 640.0
|
||||||
theme_override_font_sizes/font_size = 30
|
theme_override_font_sizes/font_size = 30
|
||||||
text = "Würfeln"
|
text = "Würfeln"
|
||||||
|
|
||||||
|
[node name="Test" type="Button" parent="GUI"]
|
||||||
|
offset_left = 24.0
|
||||||
|
offset_top = 16.0
|
||||||
|
offset_right = 248.0
|
||||||
|
offset_bottom = 112.0
|
||||||
|
theme_override_font_sizes/font_size = 35
|
||||||
|
text = "Test"
|
||||||
|
|
||||||
[connection signal="pressed" from="GUI/RestartButton" to="." method="_on_restart_button_pressed"]
|
[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/DiceButton" to="." method="_on_dice_button_pressed"]
|
||||||
|
[connection signal="pressed" from="GUI/Test" to="." method="_on_test_pressed"]
|
||||||
|
|
Loading…
Reference in New Issue