-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://Scripts/LevelTimer.gd" type="Script" id=1] | ||
[ext_resource path="res://addons/gut/fonts/AnonymousPro-Regular.ttf" type="DynamicFontData" id=2] | ||
|
||
[sub_resource type="DynamicFont" id=1] | ||
size = 100 | ||
use_filter = true | ||
font_data = ExtResource( 2 ) | ||
|
||
[node name="Control" type="Control"] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
script = ExtResource( 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Label" type="Label" parent="."] | ||
anchor_left = 0.5 | ||
anchor_top = 0.5 | ||
anchor_right = 0.5 | ||
anchor_bottom = 0.5 | ||
margin_left = -441.5 | ||
margin_top = -120.0 | ||
margin_right = 441.5 | ||
margin_bottom = 120.0 | ||
grow_vertical = 2 | ||
rect_clip_content = true | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 1 | ||
custom_fonts/font = SubResource( 1 ) | ||
text = "Timer" | ||
align = 1 | ||
valign = 1 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
extends Control | ||
|
||
var time : float = 0.0 | ||
var runTimer : bool = false | ||
|
||
onready var label = get_node("Label") | ||
|
||
func _process(delta): | ||
if runTimer: | ||
time += delta | ||
|
||
var mils = fmod(time, 1) * 1000 | ||
var secs = fmod(time, 60) | ||
var mins = floor(time / 60) | ||
|
||
label.text = "%02d:%02d:%03d" % [mins, secs, mils] | ||
|
||
func _ready(): | ||
runTimer = true |