mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
ModGodToolset Template
Additional default elements added to template, including liberation serif fonts, global DiceRoller script and misc.
This commit is contained in:
parent
5a930dcbf5
commit
5227d27cb1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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 )
|
@ -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 )
|
@ -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 )
|
@ -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 )
|
@ -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)
|
@ -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 ""
|
||||
|
@ -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"]
|
Loading…
Reference in New Issue
Block a user