Dwenny/android/build/assets/Scripts/Main.gd
Zoey 35b5df9c10 Working
math works
touch works
unicode arrows on android don't
2024-01-19 14:07:20 +01:00

45 lines
1.3 KiB
GDScript

extends Control
@onready var MultiplierLB = $MainMC/VBoxContainer/EnumMC/EnumHB/VBoxContainer/MPLB/MultiplierLB
@onready var DieTypeLB = $MainMC/VBoxContainer/EnumMC/EnumHB/VBoxContainer2/DTTP/DieTypeLB
@onready var DieLB = $MainMC/VBoxContainer/Die/DiceCR/DieLB
var Multiplier : int = 1
var ChosenDie : int = 20
func _ready():
pass
func _process(_delta):
MultiplierLB.text = str(Multiplier)
DieTypeLB.text = str(ChosenDie)
func Die():
var result = ChosenDie * Multiplier
return randi() % result + 1
var dice_values = [4, 6, 8, 10, 12, 20]
func _on_updt_gui_input(event):
if event is InputEventScreenTouch and event.is_pressed():
if ChosenDie < 20:
ChosenDie = dice_values[dice_values.find(ChosenDie)+1]
func _on_dwdt_gui_input(event):
if event is InputEventScreenTouch and event.is_pressed():
if ChosenDie > 4:
ChosenDie = dice_values[dice_values.find(ChosenDie)-1]
func _on_mpup_gui_input(event):
if event is InputEventScreenTouch and event.is_pressed():
if Multiplier < 10:
Multiplier += 1
func _on_mpdw_gui_input(event):
if event is InputEventScreenTouch and event.is_pressed():
if Multiplier > 1:
Multiplier -= 1
func _on_roll_rect_gui_input(event:InputEvent):
if event is InputEventScreenTouch and event.is_pressed():
Die();
DieLB.text = str(Die());