1
Fork 0
mirror of https://github.com/Cookie-CHR/OfficeMadness-LD51.git synced 2024-11-23 15:14:18 +00:00

⚙️ Fixed time not resetting

This commit is contained in:
Cookie-CHR 2022-10-04 12:03:41 +02:00
parent 386b3a53c2
commit b120456474
18 changed files with 45 additions and 26 deletions

View file

@ -1,3 +1,3 @@
source_md5="079efcbf483b26f2c408230ebe2b7b9d" source_md5="8406aa5d39658d07f4df6eb8d30b6efe"
dest_md5="13eacbf430e7e68f7610730f2e60fd75" dest_md5="139510e0d03c987cee6b0d307c32a3bb"

View file

@ -0,0 +1,3 @@
source_md5="cf4aec4842e6f28b128d15ef58be76d0"
dest_md5="f713b52cc8973914be7fa878566b7e90"

View file

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="26ea799ea0a3da9e753b3ebe822e0570"

View file

@ -0,0 +1,3 @@
source_md5="7e41bf3051b18e392a4bb6c0cc45cd7c"
dest_md5="73e4f4d3969b9486e63fd804f5f0f1a9"

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=2] [gd_scene load_steps=12 format=2]
[ext_resource path="res://Scripts/Play.gd" type="Script" id=1] [ext_resource path="res://Scripts/Play.gd" type="Script" id=1]
[ext_resource path="res://Sprites/Play_again_button.png" type="Texture" id=2] [ext_resource path="res://Sprites/Play_again_button.png" type="Texture" id=2]
@ -8,14 +8,14 @@
[ext_resource path="res://Music/Music_Changer.gd" type="Script" id=6] [ext_resource path="res://Music/Music_Changer.gd" type="Script" id=6]
[ext_resource path="res://Sprites/Music_On.png" type="Texture" id=7] [ext_resource path="res://Sprites/Music_On.png" type="Texture" id=7]
[ext_resource path="res://Fonts/Life is goofy.ttf" type="DynamicFontData" id=8] [ext_resource path="res://Fonts/Life is goofy.ttf" type="DynamicFontData" id=8]
[ext_resource path="res://Scripts/Time_Display.gd" type="Script" id=9]
[sub_resource type="DynamicFont" id=1] [sub_resource type="DynamicFont" id=1]
size = 80 size = 80
font_data = ExtResource( 4 ) font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=2] [sub_resource type="DynamicFont" id=2]
size = 35 size = 90
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 8 ) font_data = ExtResource( 8 )
[node name="Panel" type="Panel"] [node name="Panel" type="Panel"]
@ -67,21 +67,11 @@ flat = true
[node name="Label2" type="Label" parent="."] [node name="Label2" type="Label" parent="."]
modulate = Color( 0, 0, 0, 1 ) modulate = Color( 0, 0, 0, 1 )
margin_left = 302.0 margin_left = 297.0
margin_top = 160.0 margin_top = 308.0
margin_right = 681.0 margin_right = 993.0
margin_bottom = 577.0 margin_bottom = 368.0
custom_fonts/font = SubResource( 2 ) custom_fonts/font = SubResource( 2 )
text = "Music by Kevin Macleod (incompetech.com) text = "60 minutes and 60 seconds"
Sound by FreeSound align = 1
script = ExtResource( 9 )
Made by Cookie-CHR for Ludum Dare 51"

View file

@ -42,7 +42,7 @@ func on_finished():
var sprite = Sprite.new() var sprite = Sprite.new()
sprite.texture = completed sprite.texture = completed
spawnpoint.add_child(sprite) spawnpoint.add_child(sprite)
sprite.position = Vector2(348, 320) sprite.position = Vector2(300, 270)
var sound = audiostream.instance() var sound = audiostream.instance()
spawnpoint.add_child(sound) spawnpoint.add_child(sound)
sound._play("victory") sound._play("victory")

View file

@ -5,6 +5,7 @@ var muted = preload("res://Sprites/Music_Off.png")
var unmuted = preload("res://Sprites/Music_On.png") var unmuted = preload("res://Sprites/Music_On.png")
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
GlobalTimer._stop()
for child in get_children(): for child in get_children():
if child.name == "Play": if child.name == "Play":
child.connect("pressed", self, "_play") child.connect("pressed", self, "_play")

View file

@ -6,7 +6,14 @@ var seconds_passed
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
seconds_passed = 0 _play()
func _on_Timer_timeout(): func _on_Timer_timeout():
seconds_passed += 1 seconds_passed += 1
func _play():
seconds_passed = 0
start()
func _stop():
stop()

12
Scripts/Time_Display.gd Normal file
View file

@ -0,0 +1,12 @@
extends Label
# Called when the node enters the scene tree for the first time.
func _ready():
var seconds = GlobalTimer.seconds_passed%60
var minutes = (GlobalTimer.seconds_passed/60)%60
var string = ""
if minutes > 0:
string += str(minutes)+" minutes and"
string += str(seconds)+" seconds"
self.text = string

View file

@ -18,6 +18,7 @@ func _ready():
elif child.name=="SpawnPoint": elif child.name=="SpawnPoint":
MManager.reset_spawnpoint(child) MManager.reset_spawnpoint(child)
randomize() randomize()
GlobalTimer._play()
_on_Timer_timeout() _on_Timer_timeout()
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.

View file

@ -3,7 +3,6 @@
[ext_resource path="res://Scripts/TimePassed.gd" type="Script" id=1] [ext_resource path="res://Scripts/TimePassed.gd" type="Script" id=1]
[node name="Timer" type="Timer"] [node name="Timer" type="Timer"]
autostart = true
script = ExtResource( 1 ) script = ExtResource( 1 )
[connection signal="timeout" from="." to="." method="_on_Timer_timeout"] [connection signal="timeout" from="." to="." method="_on_Timer_timeout"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

View file

@ -12,7 +12,7 @@ config_version=4
config/name="LD51 - Office Madness" config/name="LD51 - Office Madness"
run/main_scene="res://Scenes/Title.tscn" run/main_scene="res://Scenes/Title.tscn"
config/icon="res://icon.png" config/icon="res://Sprites/Me.png"
[autoload] [autoload]