From de708954cf2f703be5edc6cc4c31e83c1676218d Mon Sep 17 00:00:00 2001
From: Luke Gebbink <48702026+PersonGuyGit@users.noreply.github.com>
Date: Sun, 9 Jan 2022 13:01:00 -0700
Subject: [PATCH] Mades some changes to my die roller class, and fixed a few
typos.
---
Godot/MainMenu/GodotUserInterface_Luke/Die.gd | 86 +++++++++++++------
.../MainMenu/GodotUserInterface_Luke/GUI.tscn | 30 ++++---
...matar_SaveAndLoadGame_UML_2021.9.19.drawio | 2 +-
3 files changed, 81 insertions(+), 37 deletions(-)
diff --git a/Godot/MainMenu/GodotUserInterface_Luke/Die.gd b/Godot/MainMenu/GodotUserInterface_Luke/Die.gd
index ba8acc3..a2e047a 100644
--- a/Godot/MainMenu/GodotUserInterface_Luke/Die.gd
+++ b/Godot/MainMenu/GodotUserInterface_Luke/Die.gd
@@ -6,42 +6,76 @@ class_name Die
# var b = "text"
enum DieCategory{
- D4,
- D6,
- D8,
- D10,
- D12,
- D00,
- D20
+ D4 = 4,
+ D6 = 6,
+ D8 = 8,
+ D10 = 10,
+ D12 = 12,
+ D00 = 00,
+ D20 = 20
}
-var dieType = DieCategory
-var numberOfFaces = 0
+var DieType = DieCategory
+var NumberOfFaces = 0
+
+
+func RollDie(InputDie):
+ #InputDie is supposed to be DieType for example.
+ var DieFaceResult = 0;
+ var LowestPossibleNumberOnDie = 0
+ var rng = RandomNumberGenerator.new()
+
+ var NoOfSides = NumberOfFaces
+
+ match NoOfSides:
+ 100:
+ LowestPossibleNumberOnDie = 0
+ #Will need to come up with a solution just for 00 Dice.
+
+ _:
+ LowestPossibleNumberOnDie = 1
+ DieFaceResult = rng.randi_range(LowestPossibleNumberOnDie, NumberOfFaces)
+
+ var DieSuccessPercentage = DieFaceResult/NumberOfFaces
+
+ print("DieFace:")
+ print(DieFaceResult)
+
func SetNumberOfSides():
- var DSides = dieType
-
+ var DSides = DieType
+# For 7 Die Set, testing purposes
+
+
+########################################
+# Need to Seed Random Number Generator #
+########################################
match DSides:
- D4:
- numberOfFaces = 4
- D6:
- numberOfFaces = 6
- D8:
- numberOfFaces = 8
- D10:
- numberOfFaces = 10
- D12:
- numberOfFaces = 12
- D00:
- numberOfFaces = 100
- D20:
- numberOfFaces = 20
+ 4:
+ NumberOfFaces = 4
+ 6:
+ NumberOfFaces = 6
+ 8:
+ NumberOfFaces = 8
+ 10:
+ NumberOfFaces = 10
+ 12:
+ NumberOfFaces = 12
+ 00:
+ NumberOfFaces = 100
+ 20:
+ NumberOfFaces = 20
+
+ print(NumberOfFaces)
# Called when the node enters the scene tree for the first time.
func _ready():
- pass # Replace with function body.
+ DieType = DieCategory.D20
+ SetNumberOfSides()
+ RollDie(NumberOfFaces)
+ # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
diff --git a/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn b/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn
index 6ff3a4c..f9a929f 100644
--- a/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn
+++ b/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn
@@ -1,9 +1,10 @@
-[gd_scene load_steps=5 format=2]
+[gd_scene load_steps=6 format=2]
[ext_resource path="res://Player_Settings_Button.gd" type="Script" id=1]
[ext_resource path="res://HostAndJoinGame.gd" type="Script" id=2]
[ext_resource path="res://Start Game.gd" type="Script" id=3]
[ext_resource path="res://GUI.gd" type="Script" id=4]
+[ext_resource path="res://Die.gd" type="Script" id=5]
[node name="GUI" type="MarginContainer"]
anchor_right = 1.0
@@ -37,33 +38,41 @@ custom_constants/separation = 30
alignment = 1
[node name="Start Game" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
-margin_top = 147.0
+margin_top = 125.0
margin_right = 112.0
-margin_bottom = 161.0
+margin_bottom = 139.0
mouse_filter = 1
text = "Start Game"
script = ExtResource( 3 )
-[node name="Load Game" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
-margin_top = 191.0
+[node name="DieTest" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
+margin_top = 169.0
margin_right = 112.0
-margin_bottom = 205.0
+margin_bottom = 183.0
+mouse_filter = 1
+text = "Die Test"
+script = ExtResource( 5 )
+
+[node name="Load Game" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
+margin_top = 213.0
+margin_right = 112.0
+margin_bottom = 227.0
mouse_filter = 1
text = "Load Game"
script = ExtResource( 3 )
[node name="HostAndJoinGame" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
-margin_top = 235.0
+margin_top = 257.0
margin_right = 112.0
-margin_bottom = 249.0
+margin_bottom = 271.0
mouse_filter = 1
text = "Host / Join Game"
script = ExtResource( 2 )
[node name="Player Settings" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
-margin_top = 279.0
+margin_top = 301.0
margin_right = 112.0
-margin_bottom = 293.0
+margin_bottom = 315.0
mouse_filter = 1
text = "Player Settings"
script = ExtResource( 1 )
@@ -83,6 +92,7 @@ margin_bottom = 227.0
text = "Test Menu"
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/Start Game" to="HBoxContainer/VBoxContainer/MenuOptions/Start Game" method="_on_Start_Game_gui_input"]
+[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/DieTest" to="HBoxContainer/VBoxContainer/MenuOptions/DieTest" method="_on_Start_Game_gui_input"]
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/Load Game" to="HBoxContainer/VBoxContainer/MenuOptions/Load Game" method="_on_Start_Game_gui_input"]
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" to="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" method="_on_HostAndJoinGame_gui_input"]
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/Player Settings" to="HBoxContainer/VBoxContainer/MenuOptions/Player Settings" method="_on_Player_Settings_gui_input"]
diff --git a/UML Diagrams/LoadAndSaveGame/ProjectIlmatar_SaveAndLoadGame_UML_2021.9.19.drawio b/UML Diagrams/LoadAndSaveGame/ProjectIlmatar_SaveAndLoadGame_UML_2021.9.19.drawio
index ba44dd4..2934fa3 100644
--- a/UML Diagrams/LoadAndSaveGame/ProjectIlmatar_SaveAndLoadGame_UML_2021.9.19.drawio
+++ b/UML Diagrams/LoadAndSaveGame/ProjectIlmatar_SaveAndLoadGame_UML_2021.9.19.drawio
@@ -1 +1 @@
-7VttT+M4EP41lfaQQHlpu+VjX4D7AHvslRN3n04mMa3BiSvHpXR//Y1ju3lxCilNlj0pEoJ4MnaceWbGjyem50+j1yuOVssbFmLa85zwtefPep7nOv4I/kjJVkmGzlclWHASaqVMMCc/sOmppWsS4qSgKBijgqyKwoDFMQ5EQYY4Z5ui2iOjxaeu0AJbgnmAqC29J6FYKulo4GTy3zFZLM2TXUffiZBR1oJkiUK2yYn8i54/5YwJdRW9TjGVxjN2Uf0u99zdTYzjWNTpMNzcLZ1/nclT9Nf3KX9ePJ1/vzodqFFeEF3rF77B8VpPWGyNFZINiSiKoTV5ZLGY6zsutBElixiuA5gG5iB4wVwQMOBY3xBsBdJgSWh4jbZsLSebCBQ8m9ZkyTj5AcMiqseE21xoX/CGBY257AliB6QcJ6BzayzglkQ36LWgeI0SoQUBoxStEvKwe40I8QWJJ0wIFmklbRp4Hfy61+buDkkIAcwiLPgWVHSHvsZeO79nnGOTuZI71LJlwY102CDtvovd0BnCcKFBPgDwoQX4qeyS3KJ1gkO47Plj+P0AMYZR3APre74rrSHVNigWyR27Zkhqnub1Sg4DJhMpkJw94ymjDDxjFjPlQYTSksg4EcWPYq8LJSsUkHhxnerM+pnkT204KWLQ95GmcbYkYYhjCT8TSCCFtXyVFSPwHnKigwn8gP2nztmgN4CJT6HtZm34kepcTFkM74JICjsGR9pg6Uz1fGR/5NmOYzxlWM9R/H5LfvLV8hMLY0pS7BTGJjm6HwI4AqgozhC9k4DPTl0Ldd9G3a9AmKIHTG9ZQgRhcnyudEvIfxa4w5pZoK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