improve pause menu behavior
This commit is contained in:
parent
ef5e8268c5
commit
df6a44bc8e
3 changed files with 12 additions and 4 deletions
|
@ -2,18 +2,23 @@ extends Node2D
|
||||||
|
|
||||||
onready var texture : TextureRect = $TextureRect
|
onready var texture : TextureRect = $TextureRect
|
||||||
|
|
||||||
|
var force_stop = false
|
||||||
var moving = false
|
var moving = false
|
||||||
|
|
||||||
func stop():
|
func stop():
|
||||||
moving = false
|
moving = false
|
||||||
|
force_stop = true
|
||||||
texture.material.set_shader_param("scroll_speed", 0)
|
texture.material.set_shader_param("scroll_speed", 0)
|
||||||
|
|
||||||
func start():
|
func start():
|
||||||
moving = true
|
moving = true
|
||||||
|
force_stop = false
|
||||||
texture.material.set_shader_param("scroll_speed", 0.2)
|
texture.material.set_shader_param("scroll_speed", 0.2)
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if get_tree().paused and moving:
|
if not force_stop:
|
||||||
stop()
|
if get_tree().paused and moving:
|
||||||
elif not get_tree().paused and not moving:
|
stop()
|
||||||
start()
|
force_stop = false
|
||||||
|
elif not get_tree().paused and not moving:
|
||||||
|
start()
|
||||||
|
|
|
@ -11,6 +11,7 @@ font_data = ExtResource( 4 )
|
||||||
|
|
||||||
[node name="PauseMenu" type="Control"]
|
[node name="PauseMenu" type="Control"]
|
||||||
pause_mode = 2
|
pause_mode = 2
|
||||||
|
visible = false
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
|
@ -51,6 +51,8 @@ __meta__ = {
|
||||||
margin_left = 1836.0
|
margin_left = 1836.0
|
||||||
margin_right = 1900.0
|
margin_right = 1900.0
|
||||||
margin_bottom = 64.0
|
margin_bottom = 64.0
|
||||||
|
focus_mode = 0
|
||||||
|
enabled_focus_mode = 0
|
||||||
texture_normal = ExtResource( 1 )
|
texture_normal = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="MarginContainer/HBoxContainer/TextureButton"]
|
[node name="ColorRect" type="ColorRect" parent="MarginContainer/HBoxContainer/TextureButton"]
|
||||||
|
|
Loading…
Reference in a new issue