This commit is contained in:
fram3d 2024-07-05 01:54:23 +02:00
parent 16c1857788
commit 1098453b5e
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
13 changed files with 151 additions and 1 deletions

View File

@ -0,0 +1,3 @@
source_md5="ea70ad65cae93d474483e7709e543dac"
dest_md5="59c8e93bedf75c1f3aa313f10b030468"

View File

@ -0,0 +1,3 @@
source_md5="d81b98260931c2758f0a53edaa052c2e"
dest_md5="ea3bcd09037e5a0180b92cb09eee9e82"

View File

@ -0,0 +1,3 @@
source_md5="cf4e7f29d2304ad291f0348a9ba0fa19"
dest_md5="9f55c32f5fc2d8c3dd5c4467572ec9c9"

22
src/UI/GUI.gd Normal file
View File

@ -0,0 +1,22 @@
extends CanvasLayer
#onready var fps = get("physics/common/physics_fps")
onready var fps = Engine.target_fps
onready var timer = $"/root/World/Timer"
onready var timerspeed = timer.wait_time
func _on_pause_toggled(button_pressed):
get_tree().paused = button_pressed
func _on_speed_toggled(button_pressed):
if button_pressed:
Engine.time_scale = 2
Engine.iterations_per_second = 10
else:
Engine.time_scale = 1
Engine.iterations_per_second = 5

41
src/UI/GUI.tscn Normal file
View File

@ -0,0 +1,41 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://UI/pause.png" type="Texture" id=1]
[ext_resource path="res://UI/speed.png" type="Texture" id=2]
[ext_resource path="res://UI/GUI.gd" type="Script" id=3]
[node name="GUI" type="CanvasLayer"]
pause_mode = 2
script = ExtResource( 3 )
[node name="HBoxContainer" type="HBoxContainer" parent="."]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -6.0
margin_right = 49.0
margin_bottom = 24.0
rect_scale = Vector2( 0.1, 0.1 )
alignment = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="pause" type="Button" parent="HBoxContainer"]
margin_left = 2.0
margin_right = 24.0
margin_bottom = 20.0
size_flags_horizontal = 0
size_flags_vertical = 0
toggle_mode = true
icon = ExtResource( 1 )
[node name="speed" type="Button" parent="HBoxContainer"]
margin_left = 28.0
margin_right = 55.0
margin_bottom = 20.0
size_flags_horizontal = 0
size_flags_vertical = 0
toggle_mode = true
icon = ExtResource( 2 )
[connection signal="toggled" from="HBoxContainer/pause" to="." method="_on_pause_toggled"]
[connection signal="toggled" from="HBoxContainer/speed" to="." method="_on_speed_toggled"]

BIN
src/UI/pause.png (Stored with Git LFS) Normal file

Binary file not shown.

34
src/UI/pause.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/pause.png-2588384f69d078ed3af39e5e39672e7d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/pause.png"
dest_files=[ "res://.import/pause.png-2588384f69d078ed3af39e5e39672e7d.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=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
src/UI/speed.png (Stored with Git LFS) Normal file

Binary file not shown.

34
src/UI/speed.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/speed.png-75f5ca870dd580ad6bde90f6052ac60c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/speed.png"
dest_files=[ "res://.import/speed.png-75f5ca870dd580ad6bde90f6052ac60c.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=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=23 format=2]
[gd_scene load_steps=24 format=2]
[ext_resource path="res://Tilesets/stone.png" type="Texture" id=1]
[ext_resource path="res://Tilesets/dirt.png" type="Texture" id=2]
[ext_resource path="res://Tilesets/water.png" type="Texture" id=3]
[ext_resource path="res://UI/GUI.tscn" type="PackedScene" id=4]
[ext_resource path="res://Audio/Background/cave.ogg" type="AudioStream" id=7]
[ext_resource path="res://camera.gd" type="Script" id=8]
[ext_resource path="res://spawn.gd" type="Script" id=10]
@ -218,6 +219,7 @@ points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 )
[node name="World" type="Node2D"]
[node name="Camera2D" type="Camera2D" parent="."]
pause_mode = 2
position = Vector2( 132, 132 )
current = true
zoom = Vector2( 4, 4 )
@ -243,4 +245,6 @@ process_mode = 0
wait_time = 10.0
autostart = true
script = ExtResource( 10 )
[node name="GUI" parent="." instance=ExtResource( 4 )]
[connection signal="timeout" from="Timer" to="Timer" method="_on_Timer_timeout"]