Skip to content

Instantly share code, notes, and snippets.

@regakakobigman
regakakobigman / dice.gd
Created May 21, 2019 07:20
Simple dice calculator in Godot
extends Node
var dice_regex = RegEx.new()
func _ready() -> void:
randomize()
dice_regex.compile("(?<dice>[0-9]*)?d(?<sides>[0-9]+)(?: ?(?<operator>\\+|-) ?(?<modifier>[0-9]*))?")
func rand_dice(dice: String) -> int:
"""