Made background change randomly every 45 seconds
This commit is contained in:
parent
e6130c3be9
commit
0f926436cc
12
Main_menu.gd
12
Main_menu.gd
@ -7,6 +7,8 @@ var local_version # The version installed on this computer
|
||||
var os_name # The simplified name of the OS (linux, or windows)
|
||||
var suffix #
|
||||
|
||||
var random
|
||||
|
||||
# Load in the Notice_msg scene (Will be instanced)
|
||||
var Notice_msg = load("res://Notice_msg.tscn")
|
||||
|
||||
@ -49,7 +51,7 @@ func _process(_delta):
|
||||
# When everything is loaded,
|
||||
func _ready():
|
||||
# Randomize
|
||||
var random = RandomNumberGenerator.new()
|
||||
random = RandomNumberGenerator.new()
|
||||
random.randomize()
|
||||
|
||||
# Choose a background
|
||||
@ -173,3 +175,11 @@ func _on_Play_button_pressed():
|
||||
else:
|
||||
notice("Executable not found! Click 'UPDATE' to install it again", "alert")
|
||||
Store.write_store("current_version", "")
|
||||
|
||||
# When the background change timer time's out,
|
||||
func _on_Change_timer_timeout():
|
||||
# Choose a background
|
||||
var background_num = random.randi_range(1, 2)
|
||||
|
||||
# Set the background
|
||||
$Background.texture = load("res://textures/backgrounds/background"+str(background_num)+".png")
|
||||
|
@ -52,6 +52,10 @@ texture = ExtResource( 1 )
|
||||
expand = true
|
||||
stretch_mode = 7
|
||||
|
||||
[node name="Change_timer" type="Timer" parent="Background"]
|
||||
wait_time = 45.0
|
||||
autostart = true
|
||||
|
||||
[node name="Header" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 53.0
|
||||
@ -97,4 +101,5 @@ margin_top = 80.0
|
||||
margin_right = 192.0
|
||||
margin_bottom = 272.0
|
||||
|
||||
[connection signal="timeout" from="Background/Change_timer" to="." method="_on_Change_timer_timeout"]
|
||||
[connection signal="pressed" from="Panel/Play_button" to="." method="_on_Play_button_pressed"]
|
||||
|
Loading…
Reference in New Issue
Block a user