diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Bold.ttf b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Bold.ttf new file mode 100644 index 0000000..db3d6f3 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Bold.ttf differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-BoldItalic.ttf b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-BoldItalic.ttf new file mode 100644 index 0000000..8b21277 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-BoldItalic.ttf differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Italic.ttf b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Italic.ttf new file mode 100644 index 0000000..768b833 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Italic.ttf differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Regular.ttf b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Regular.ttf new file mode 100644 index 0000000..6fa9a59 Binary files /dev/null and b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/Fonts_source/LiberationSerif-Regular.ttf differ diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif.tres b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif.tres new file mode 100644 index 0000000..051bc09 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif.tres @@ -0,0 +1,6 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +font_data = ExtResource( 1 ) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_20pt.tres b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_20pt.tres new file mode 100644 index 0000000..2953618 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_20pt.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 20 +font_data = ExtResource( 1 ) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_30pt.tres b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_30pt.tres new file mode 100644 index 0000000..6297862 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_30pt.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 30 +font_data = ExtResource( 1 ) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_40pt.tres b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_40pt.tres new file mode 100644 index 0000000..229621e --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/assets/fonts/liberation_serif_40pt.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 40 +font_data = ExtResource( 1 ) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/globalScripts/DiceRoller.gd b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/globalScripts/DiceRoller.gd new file mode 100644 index 0000000..858415a --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/globalScripts/DiceRoller.gd @@ -0,0 +1,69 @@ +#This script is for the overarching node that will contain the diemanager singleton +#It should be the only one of the die scripts that is attached onto a node. + +extends Control + +#desired dice types and needed percentage to pass are selected by game/user +#desiredDice takes an int array representing the # sides on the die/dice +#neededPercentageToPass takes a float that +export var desiredDice: Array +export var neededPercentageToPass: float + +#Define dieManager variable +var dieManager + +func _ready(): + #create diemanager object + dieManager = DieManager.new(desiredDice, neededPercentageToPass) + +#function gets the result of the roll(s) and shows it in the UI +func _on_Die_button_down(): + #rollDice function returns an array with the following elements in the following positions: + #rollDice result: [[rolledValues], percentRolled, passResult, neededPercent, degreeOfSuccess, dice] + var result = dieManager.rollDice() + + + #assigning variable names to each of them for better clarity + var rolledValues = result[0] + var percentRolled = result[1] + var passResult = result[2] + var neededPercent = result[3] + var degreeOfSuccess = result[4] + var dice = result[5] + + + #Check if passed or not + if passResult: + $Outcome.text = "Successful Roll!" + else: + $Outcome.text = "Failed Roll!" + + var diceResultText = "Rolled Values:\n" + + #Prints the integer calues of each die rolled in the form: "D(num faces): (value rolled)" + for i in range(dice.size()): + diceResultText += ("D" + str(dice[i]) + ": " + str(rolledValues[i]) + "\n") + + #changing labels on screen + $RolledValues.text = diceResultText + $PercentNeeded.text = "Percent Needed to Pass: " + str(neededPercent * 100) + "%" + $PercentRolled.text = "Percent Rolled: " + str(percentRolled * 100) + "%" + $DegreeOfSuccess.text = "Degree of Success: " + str(degreeOfSuccess * 100) + "%" + + #revealing labels to user + $Outcome.show() + $RolledValues.show() + $PercentNeeded.show() + $PercentRolled.show() + $DegreeOfSuccess.show() + + +#Calls the cleardata method for the diemanager and hides the text on screen +func _on_Reset_button_down(): + $Outcome.hide() + $PercentNeeded.hide() + $PercentRolled.hide() + $DegreeOfSuccess.hide() + $RolledValues.hide() + dieManager.clearData() + dieManager.setDieManager(desiredDice, neededPercentageToPass) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/userInterface/But_ChangeScene.gd b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/userInterface/But_ChangeScene.gd new file mode 100644 index 0000000..0ad7b66 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/userInterface/But_ChangeScene.gd @@ -0,0 +1,18 @@ +#BUT_CHANGESCENE: +# Generic template script allowing GUI linking of scenes by button press. + +tool +extends Button + +#Creates param usable in the UI; and the params next to export make it string and file browser +export(String, FILE) var next_scene_path: = "" + + + +func _on_But_NewGame_button_up(): + get_tree().change_scene(next_scene_path) + + +func _get_configuration_warning() -> String: + return "next_scene_path must be set for this button to work" if next_scene_path == "" else "" + diff --git a/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/userInterface/But_ChangeScene.tscn b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/userInterface/But_ChangeScene.tscn new file mode 100644 index 0000000..80849fc --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/ToolsetProjectTemplate/userInterface/But_ChangeScene.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=1] + +[node name="But_ChangeScene" type="Button"] +margin_right = 130.0 +margin_bottom = 24.0 +size_flags_vertical = 3 +text = "New Game" +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="button_up" from="." to="." method="_on_But_NewGame_button_up"]