v.0.5.8: Aussetzen

- Aussetzen funktioniert
- Schere Stein Papier implementiert
main
Ileyan Al Jaaf 2024-03-30 22:07:23 +01:00
parent 68c53cd7cf
commit 6f474dc6f8
9 changed files with 188 additions and 27 deletions

BIN
assets/paper.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b1vi81hwhys1p"
path="res://.godot/imported/paper.png-6d641d0c60c2e9ec183ca1a2742b7a82.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/paper.png"
dest_files=["res://.godot/imported/paper.png-6d641d0c60c2e9ec183ca1a2742b7a82.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/scissors.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cr37od6sevrmd"
path="res://.godot/imported/scissors.png-9715baf1c9711b5d235b262f4089af69.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/scissors.png"
dest_files=["res://.godot/imported/scissors.png-9715baf1c9711b5d235b262f4089af69.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/stein.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://61xrksg1k2ek"
path="res://.godot/imported/stein.png-ec44e9c322add18ad4b69656888e6bb1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/stein.png"
dest_files=["res://.godot/imported/stein.png-ec44e9c322add18ad4b69656888e6bb1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

40
game.gd
View File

@ -7,7 +7,7 @@ var sequence_needed = 4
var _sequence = [] var _sequence = []
var enable_remove = true var enable_remove = true
@onready var gui := $GUI as Node2D
@onready var board := $Board as Board @onready var board := $Board as Board
@onready var nextPlayer := $GUI/NextPlayer as Sprite2D @onready var nextPlayer := $GUI/NextPlayer as Sprite2D
@onready var wonPlayer := $GUI/WonPlayer as Sprite2D @onready var wonPlayer := $GUI/WonPlayer as Sprite2D
@ -17,7 +17,8 @@ var enable_remove = true
@onready var player2Sprite = $GUI/Player2Sprite as Sprite2D @onready var player2Sprite = $GUI/Player2Sprite as Sprite2D
@onready var ereignis = $GUI/Event as Label @onready var ereignis = $GUI/Event as Label
@onready var sequenz = $GUI/Sequenz as Label @onready var sequenz = $GUI/Sequenz as Label
@onready var schnick = $Schnick
@onready var numbers = $Numbers as TileMap
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
@ -48,8 +49,7 @@ func _process(_delta):
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()
if won=="": if won=="":
current_player = 1 - current_player switch_player()
nextPlayer.region_rect.position.x = current_player * 300
else: else:
print("Winner: ", won) print("Winner: ", won)
wonPlayer.region_rect.position.x = player_states.find(won) * 300 wonPlayer.region_rect.position.x = player_states.find(won) * 300
@ -63,6 +63,9 @@ func _process(_delta):
nextPlayer.hide() nextPlayer.hide()
board.active = false board.active = false
func switch_player():
current_player = 1 - current_player
nextPlayer.region_rect.position.x = current_player * 300
func _on_restart_button_pressed(): func _on_restart_button_pressed():
_ready() _ready()
@ -108,9 +111,12 @@ func _roll_dice() -> int:
_update_dice_sprite(zahl) _update_dice_sprite(zahl)
print(zahl) #Debug ausgabe, später löschen print(zahl) #Debug ausgabe, später löschen
if zahl == 1:
switch_to_schnick()
return zahl return zahl
#Funktion um Knopf 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()
@ -185,8 +191,7 @@ func _instant_loose():
#Zum Testen der Events #Zum Testen der Events
func _on_test_pressed(): func _on_test_pressed():
_spin_the_wheel(15) switch_to_schnick()
ereignis.text += "test"
func _spin_the_wheel(result: int) -> void: func _spin_the_wheel(result: int) -> void:
@ -228,3 +233,26 @@ func _spin_the_wheel(result: int) -> void:
func _on_spin_the_wheel_pressed(): func _on_spin_the_wheel_pressed():
var zahl = randi() % 100 + 1 var zahl = randi() % 100 + 1
_spin_the_wheel(zahl) _spin_the_wheel(zahl)
func hide_schnick():
schnick.hide()
func switch_to_schnick():
board.hide()
numbers.hide()
gui.hide()
schnick.show()
func switch_to_game():
gui.show()
numbers.show()
board.show()
func _on_gewonnen_pressed():
hide_schnick()
switch_to_game()
func _on_verloren_pressed():
switch_player()
hide_schnick()
switch_to_game()

View File

@ -1,15 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://dmahmxghpm47w"] [gd_scene load_steps=7 format=3 uid="uid://dmahmxghpm47w"]
[ext_resource type="Script" path="res://game.gd" id="1_g1ie7"] [ext_resource type="Script" path="res://game.gd" id="1_g1ie7"]
[ext_resource type="PackedScene" uid="uid://dvlk7imglgpms" path="res://board/board.tscn" id="1_ym80r"] [ext_resource type="PackedScene" uid="uid://dvlk7imglgpms" path="res://board/board.tscn" id="1_ym80r"]
[ext_resource type="Texture2D" uid="uid://do2vfb2cj7fk" path="res://assets/sprites.png" id="3_0333r"] [ext_resource type="Texture2D" uid="uid://do2vfb2cj7fk" path="res://assets/sprites.png" id="3_0333r"]
[ext_resource type="Texture2D" uid="uid://61xrksg1k2ek" path="res://assets/stein.png" id="4_evbl8"]
[ext_resource type="Texture2D" uid="uid://cr37od6sevrmd" path="res://assets/scissors.png" id="5_clubr"]
[ext_resource type="Texture2D" uid="uid://b1vi81hwhys1p" path="res://assets/paper.png" id="6_g740b"]
[node name="Game" type="Node2D"] [node name="Game" type="Node2D"]
script = ExtResource("1_g1ie7") script = ExtResource("1_g1ie7")
[node name="Nummerierung links" parent="." instance=ExtResource("1_ym80r")] [node name="Numbers" parent="." instance=ExtResource("1_ym80r")]
position = Vector2(375, 232) position = Vector2(375, 232)
layer_0/tile_data = PackedInt32Array(65533, 1, 3, 131069, 65537, 3, 196605, 131073, 3, 262141, 196609, 3, 327677, 65537, 4, 393213, 131073, 4, 65534, 1, 3, -2, 1, 3, -1, 65537, 3, -65536, 131073, 3, -65535, 196609, 3, -65534, 65537, 4, -65533, 131073, 4) 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")] [node name="Board" parent="." instance=ExtResource("1_ym80r")]
position = Vector2(375, 232) position = Vector2(375, 232)
@ -144,7 +147,53 @@ offset_bottom = 379.0
theme_override_font_sizes/font_size = 50 theme_override_font_sizes/font_size = 50
text = "Steine zum gewinnen: " text = "Steine zum gewinnen: "
[node name="Schnick" type="Node2D" parent="."]
visible = false
[node name="Label" type="Label" parent="Schnick"]
offset_left = 912.0
offset_top = 64.0
offset_right = 2140.0
offset_bottom = 233.0
theme_override_font_sizes/font_size = 60
text = "Reallife Schere, Stein, Papier Minigame:
Hast du dir deinen nächsten Zug verdient?"
horizontal_alignment = 1
[node name="Stein" type="Sprite2D" parent="Schnick"]
position = Vector2(1466.1, 596)
scale = Vector2(0.4, 0.4)
texture = ExtResource("4_evbl8")
[node name="Scissors" type="Sprite2D" parent="Schnick"]
position = Vector2(738.1, 612)
scale = Vector2(0.45, 0.45)
texture = ExtResource("5_clubr")
[node name="Paper" type="Sprite2D" parent="Schnick"]
position = Vector2(2194.1, 620)
scale = Vector2(1.2, 1.2)
texture = ExtResource("6_g740b")
[node name="Gewonnen" type="Button" parent="Schnick"]
offset_left = 1104.0
offset_top = 976.0
offset_right = 1416.0
offset_bottom = 1120.0
theme_override_font_sizes/font_size = 60
text = "Ja"
[node name="Verloren" type="Button" parent="Schnick"]
offset_left = 1592.0
offset_top = 976.0
offset_right = 1904.0
offset_bottom = 1120.0
theme_override_font_sizes/font_size = 60
text = "Nein"
[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"] [connection signal="pressed" from="GUI/Test" to="." method="_on_test_pressed"]
[connection signal="pressed" from="GUI/Spin the Wheel" to="." method="_on_spin_the_wheel_pressed"] [connection signal="pressed" from="GUI/Spin the Wheel" to="." method="_on_spin_the_wheel_pressed"]
[connection signal="pressed" from="Schnick/Gewonnen" to="." method="_on_gewonnen_pressed"]
[connection signal="pressed" from="Schnick/Verloren" to="." method="_on_verloren_pressed"]

View File

@ -1,18 +0,0 @@
[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