Pause Button

main
Luna Brovchuk 2023-10-02 23:44:25 +02:00
parent 018267e152
commit 73cdf2aa18
7 changed files with 128 additions and 40 deletions

View File

@ -12,6 +12,7 @@ func _ready():
hp = 8
func _physics_process(delta):
if Global.playing:
var dist = global_position.distance_to(player.global_position)
if dist > 25 and dash_target == Vector2.ZERO:
$Aim.visible = false

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=2]
[gd_scene load_steps=26 format=2]
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
@ -22,6 +22,7 @@
[ext_resource path="res://src/scenes/game/camera.gd" type="Script" id=20]
[ext_resource path="res://src/scenes/game/sprites/shake_border.png" type="Texture" id=21]
[ext_resource path="res://src/scenes/game/sprites/damage.png" type="Texture" id=22]
[ext_resource path="res://src/scenes/game/sprites/pause.png" type="Texture" id=23]
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10, 60 )
@ -234,14 +235,14 @@ margin_right = 40.0
margin_bottom = 44.0
[node name="CastTime" type="Sprite" parent="UIWrapper/UI/Right/CastTime"]
position = Vector2( 256, 140 )
position = Vector2( 231, 140 )
texture = ExtResource( 7 )
[node name="CastTimeLabel" type="Label" parent="UIWrapper/UI/Right/CastTime"]
modulate = Color( 1, 0.870588, 0, 1 )
margin_left = 266.0
margin_left = 241.0
margin_top = 133.0
margin_right = 306.0
margin_right = 281.0
margin_bottom = 147.0
theme = ExtResource( 4 )
text = "0.8"
@ -252,18 +253,28 @@ margin_right = 40.0
margin_bottom = 41.0
[node name="Damage" type="Sprite" parent="UIWrapper/UI/Right/Damage"]
position = Vector2( 256, 160 )
position = Vector2( 231, 160 )
texture = ExtResource( 22 )
[node name="DamageLabel" type="Label" parent="UIWrapper/UI/Right/Damage"]
modulate = Color( 1, 0.870588, 0, 1 )
margin_left = 266.0
margin_left = 241.0
margin_top = 153.0
margin_right = 306.0
margin_right = 281.0
margin_bottom = 167.0
theme = ExtResource( 4 )
text = "15"
[node name="Pause" type="Button" parent="UIWrapper/UI/Right"]
margin_left = 272.0
margin_top = 143.0
margin_right = 298.0
margin_bottom = 163.0
toggle_mode = true
icon = ExtResource( 23 )
flat = true
icon_align = 1
[node name="Cards" type="Control" parent="UIWrapper/UI"]
visible = false
margin_right = 320.0
@ -310,3 +321,5 @@ id = 2
[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/RightPlaceholder"]
stream = ExtResource( 9 )
[connection signal="pressed" from="UIWrapper/UI/Right/Pause" to="." method="pause_pressed"]

View File

@ -26,7 +26,7 @@ var spells = [
func _ready():
Global.playing = true
Global.play_time = .0
Global.play_time = 300
Global.health = 5
Global.add_health(0)
@ -79,3 +79,7 @@ func update_ui():
$UIWrapper/UI/Right/CastTime/CastTimeLabel.text = String(player.get_recharge())
$UIWrapper/UI/Right/Damage/DamageLabel.text = String(player.get_damage())
$UIWrapper/UI/Left/LevelLabel.text = String(difficulty + 1)
$UIWrapper/UI/Right/Pause.pressed = Global.playing
func pause_pressed():
Global.playing = !Global.playing

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/pause.png-73f4605a5328cf93fa6ccbedbb975603.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/scenes/game/sprites/pause.png"
dest_files=[ "res://.import/pause.png-73f4605a5328cf93fa6ccbedbb975603.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/resume.png-9833efb9cb068bfb68c4ea72b39d9d12.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/scenes/game/sprites/resume.png"
dest_files=[ "res://.import/resume.png-9833efb9cb068bfb68c4ea72b39d9d12.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0