a game about throwing hammers made for the github game off
basic ui
bendn 2022-11-24
parent b803959 · commit 2047ae7
-rw-r--r--Main.gd3
-rw-r--r--Main.tscn5
-rw-r--r--assets/player/animations.pngbin905 -> 978 bytes
-rw-r--r--assets/ui/04B_19.ttfbin0 -> 6632 bytes
-rw-r--r--assets/ui/04B_19.ttf.import38
-rw-r--r--assets/ui/health.pngbin0 -> 92 bytes
-rw-r--r--assets/ui/health.png.import34
-rw-r--r--assets/ui/health_empty.pngbin0 -> 105 bytes
-rw-r--r--assets/ui/health_empty.png.import34
-rw-r--r--autoloads/Globals.gd3
-rw-r--r--player/player.tscn9
-rw-r--r--project.godot4
-rw-r--r--ui/button/button_disabled.tres12
-rw-r--r--ui/button/button_focus.tres13
-rw-r--r--ui/button/button_hover.tres17
-rw-r--r--ui/button/button_normal.tres17
-rw-r--r--ui/button/button_pressed.tres13
-rw-r--r--ui/hud.tscn3
-rw-r--r--ui/main.theme.tres25
-rw-r--r--ui/start.tscn57
20 files changed, 277 insertions, 10 deletions
diff --git a/Main.gd b/Main.gd
index cd2d0ac..e251cf8 100644
--- a/Main.gd
+++ b/Main.gd
@@ -1,4 +1 @@
extends Node2D
-
-func _init() -> void:
- RenderingServer.set_default_clear_color(Color.BLACK)
diff --git a/Main.tscn b/Main.tscn
index 04faf8a..4028bc7 100644
--- a/Main.tscn
+++ b/Main.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=23 format=3 uid="uid://dcaws2iac7w3y"]
+[gd_scene load_steps=24 format=3 uid="uid://dcaws2iac7w3y"]
[ext_resource type="Script" path="res://Main.gd" id="1_l4fqe"]
[ext_resource type="PackedScene" uid="uid://umj2kojm6mlo" path="res://player/player.tscn" id="1_ug1uc"]
@@ -22,6 +22,7 @@
[ext_resource type="PackedScene" uid="uid://dcbnac3k5c2bh" path="res://levels/rand/16.tscn" id="19_ko67h"]
[ext_resource type="PackedScene" uid="uid://pk206siyyege" path="res://levels/rand/17.tscn" id="20_f85eu"]
[ext_resource type="PackedScene" uid="uid://dbcrx23xsfrlp" path="res://levels/rand/18.tscn" id="21_rvdjm"]
+[ext_resource type="PackedScene" uid="uid://bnsgjilr4mn10" path="res://ui/hud.tscn" id="23_5dqpk"]
[node name="Main" type="Node2D"]
texture_filter = 1
@@ -46,3 +47,5 @@ offset = Vector2(128, 128)
current = true
zoom = Vector2(1.25, 1.25)
position_smoothing_enabled = true
+
+[node name="HUD" parent="." instance=ExtResource("23_5dqpk")]
diff --git a/assets/player/animations.png b/assets/player/animations.png
index e1c3930..81770b7 100644
--- a/assets/player/animations.png
+++ b/assets/player/animations.png
Binary files differ
diff --git a/assets/ui/04B_19.ttf b/assets/ui/04B_19.ttf
new file mode 100644
index 0000000..6338c19
--- /dev/null
+++ b/assets/ui/04B_19.ttf
Binary files differ
diff --git a/assets/ui/04B_19.ttf.import b/assets/ui/04B_19.ttf.import
new file mode 100644
index 0000000..88a5883
--- /dev/null
+++ b/assets/ui/04B_19.ttf.import
@@ -0,0 +1,38 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontFile"
+uid="uid://w8xa1kya7ls5"
+path="res://.godot/imported/04B_19.ttf-1f1fec99972bfc3a081c3771b03d1498.fontdata"
+
+[deps]
+
+source_file="res://assets/ui/04B_19.ttf"
+dest_files=["res://.godot/imported/04B_19.ttf-1f1fec99972bfc3a081c3771b03d1498.fontdata"]
+
+[params]
+
+Rendering=null
+antialiasing=0
+generate_mipmaps=false
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+force_autohinter=false
+hinting=0
+subpixel_positioning=0
+oversampling=0.0
+Fallbacks=null
+fallbacks=[]
+Compress=null
+compress=true
+preload=[{
+"chars": [],
+"glyphs": [],
+"name": "New Configuration",
+"size": 22,
+"variation_embolden": 0.0
+}]
+language_support={}
+script_support={}
+opentype_features={}
diff --git a/assets/ui/health.png b/assets/ui/health.png
new file mode 100644
index 0000000..59467f4
--- /dev/null
+++ b/assets/ui/health.png
Binary files differ
diff --git a/assets/ui/health.png.import b/assets/ui/health.png.import
new file mode 100644
index 0000000..249754b
--- /dev/null
+++ b/assets/ui/health.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://3dgefswp61jy"
+path="res://.godot/imported/health.png-c8e310077151d1ced46604f8ee9121ae.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/ui/health.png"
+dest_files=["res://.godot/imported/health.png-c8e310077151d1ced46604f8ee9121ae.ctex"]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/bptc_ldr=0
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/assets/ui/health_empty.png b/assets/ui/health_empty.png
new file mode 100644
index 0000000..4874879
--- /dev/null
+++ b/assets/ui/health_empty.png
Binary files differ
diff --git a/assets/ui/health_empty.png.import b/assets/ui/health_empty.png.import
new file mode 100644
index 0000000..ec59490
--- /dev/null
+++ b/assets/ui/health_empty.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://tpy1gjydytic"
+path="res://.godot/imported/health_empty.png-b71260b2bd53816c69b24bc3473649b4.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/ui/health_empty.png"
+dest_files=["res://.godot/imported/health_empty.png-b71260b2bd53816c69b24bc3473649b4.ctex"]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/bptc_ldr=0
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/autoloads/Globals.gd b/autoloads/Globals.gd
index a395865..e7d17ac 100644
--- a/autoloads/Globals.gd
+++ b/autoloads/Globals.gd
@@ -2,3 +2,6 @@ extends Node
var player: Player = null
var levelmanager: LevelManager = null
+
+func _init() -> void:
+ RenderingServer.set_default_clear_color(Color.BLACK)
diff --git a/player/player.tscn b/player/player.tscn
index c7d15d8..f534809 100644
--- a/player/player.tscn
+++ b/player/player.tscn
@@ -37,7 +37,7 @@ tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
-"values": [9]
+"values": [11]
}
[sub_resource type="Animation" id="Animation_5lnnm"]
@@ -108,10 +108,11 @@ script = ExtResource("1_lnsyt")
texture_filter = 1
position = Vector2(0, -14)
texture = ExtResource("2_dgplu")
-hframes = 11
+hframes = 12
frame = 9
[node name="Collision" type="CollisionShape2D" parent="."]
+visible = false
position = Vector2(0, -7)
shape = ExtResource("3_uoann")
@@ -125,18 +126,18 @@ wait_time = 0.2
one_shot = true
[node name="Hurtbox" parent="." instance=ExtResource("4_yd6uo")]
+visible = false
collision_layer = 4
[node name="Collision" parent="Hurtbox" index="0"]
-visible = false
position = Vector2(0, -7)
shape = ExtResource("3_uoann")
[node name="Hitbox" parent="." instance=ExtResource("5_wpn72")]
+visible = false
collision_mask = 8
[node name="Collision" parent="Hitbox" index="0"]
-visible = false
position = Vector2(0, -7)
shape = ExtResource("3_uoann")
diff --git a/project.godot b/project.godot
index 5ee610d..ffa6260 100644
--- a/project.godot
+++ b/project.godot
@@ -93,9 +93,9 @@ _global_script_class_icons={
[application]
config/name="hammer space"
-run/main_scene="res://Main.tscn"
+run/main_scene="res://ui/start.tscn"
config/use_custom_user_dir=true
-config/custom_user_dir_name="GodotTemplate"
+config/custom_user_dir_name="hamm"
config/features=PackedStringArray("4.0")
[autoload]
diff --git a/ui/button/button_disabled.tres b/ui/button/button_disabled.tres
new file mode 100644
index 0000000..bb3182f
--- /dev/null
+++ b/ui/button/button_disabled.tres
@@ -0,0 +1,12 @@
+[gd_resource type="StyleBoxFlat" format=3 uid="uid://cuwclicw8mxmg"]
+
+[resource]
+content_margin_left = 10.0
+content_margin_top = 10.0
+content_margin_right = 10.0
+content_margin_bottom = 10.0
+bg_color = Color(0.0627451, 0.113725, 0.129412, 1)
+corner_radius_top_left = 10
+corner_radius_top_right = 10
+corner_radius_bottom_right = 10
+corner_radius_bottom_left = 10
diff --git a/ui/button/button_focus.tres b/ui/button/button_focus.tres
new file mode 100644
index 0000000..eba9584
--- /dev/null
+++ b/ui/button/button_focus.tres
@@ -0,0 +1,13 @@
+[gd_resource type="StyleBoxFlat" format=3 uid="uid://caxtg2fj6ffqx"]
+
+[resource]
+bg_color = Color(0.133333, 0.215686, 0.239216, 1)
+border_width_left = 5
+border_width_top = 5
+border_width_right = 5
+border_width_bottom = 5
+border_color = Color(0.933333, 0.909804, 0.835294, 1)
+corner_radius_top_left = 10
+corner_radius_top_right = 10
+corner_radius_bottom_right = 10
+corner_radius_bottom_left = 10
diff --git a/ui/button/button_hover.tres b/ui/button/button_hover.tres
new file mode 100644
index 0000000..34233ed
--- /dev/null
+++ b/ui/button/button_hover.tres
@@ -0,0 +1,17 @@
+[gd_resource type="StyleBoxFlat" format=3 uid="uid://5c652jqp6x8q"]
+
+[resource]
+content_margin_left = 10.0
+content_margin_top = 10.0
+content_margin_right = 10.0
+content_margin_bottom = 10.0
+bg_color = Color(0.101961, 0.172549, 0.192157, 1)
+border_width_left = 5
+border_width_top = 5
+border_width_right = 5
+border_width_bottom = 5
+border_color = Color(0.513726, 0.580392, 0.588235, 1)
+corner_radius_top_left = 10
+corner_radius_top_right = 10
+corner_radius_bottom_right = 10
+corner_radius_bottom_left = 10
diff --git a/ui/button/button_normal.tres b/ui/button/button_normal.tres
new file mode 100644
index 0000000..c572f41
--- /dev/null
+++ b/ui/button/button_normal.tres
@@ -0,0 +1,17 @@
+[gd_resource type="StyleBoxFlat" format=3 uid="uid://483vjasgeg6x"]
+
+[resource]
+content_margin_left = 10.0
+content_margin_top = 10.0
+content_margin_right = 10.0
+content_margin_bottom = 10.0
+bg_color = Color(0.101961, 0.172549, 0.192157, 1)
+border_width_left = 5
+border_width_top = 5
+border_width_right = 5
+border_width_bottom = 5
+border_color = Color(0.145098, 0.231373, 0.254902, 1)
+corner_radius_top_left = 10
+corner_radius_top_right = 10
+corner_radius_bottom_right = 10
+corner_radius_bottom_left = 10
diff --git a/ui/button/button_pressed.tres b/ui/button/button_pressed.tres
new file mode 100644
index 0000000..8a95654
--- /dev/null
+++ b/ui/button/button_pressed.tres
@@ -0,0 +1,13 @@
+[gd_resource type="StyleBoxFlat" format=3 uid="uid://kccji4f3l86p"]
+
+[resource]
+content_margin_left = 10.0
+content_margin_top = 10.0
+content_margin_right = 10.0
+content_margin_bottom = 10.0
+bg_color = Color(0.101961, 0.172549, 0.192157, 1)
+border_color = Color(0.933333, 0.909804, 0.835294, 1)
+corner_radius_top_left = 10
+corner_radius_top_right = 10
+corner_radius_bottom_right = 10
+corner_radius_bottom_left = 10
diff --git a/ui/hud.tscn b/ui/hud.tscn
new file mode 100644
index 0000000..e2e7ee4
--- /dev/null
+++ b/ui/hud.tscn
@@ -0,0 +1,3 @@
+[gd_scene format=3 uid="uid://bnsgjilr4mn10"]
+
+[node name="HUD" type="CanvasLayer"]
diff --git a/ui/main.theme.tres b/ui/main.theme.tres
new file mode 100644
index 0000000..3991c0f
--- /dev/null
+++ b/ui/main.theme.tres
@@ -0,0 +1,25 @@
+[gd_resource type="Theme" load_steps=7 format=3 uid="uid://b5sr8elfovyw3"]
+
+[ext_resource type="StyleBox" uid="uid://caxtg2fj6ffqx" path="res://ui/button/button_focus.tres" id="1_8x0ae"]
+[ext_resource type="StyleBox" uid="uid://483vjasgeg6x" path="res://ui/button/button_normal.tres" id="1_e241j"]
+[ext_resource type="StyleBox" uid="uid://cuwclicw8mxmg" path="res://ui/button/button_disabled.tres" id="1_kdwa2"]
+[ext_resource type="StyleBox" uid="uid://5c652jqp6x8q" path="res://ui/button/button_hover.tres" id="3_kg542"]
+[ext_resource type="StyleBox" uid="uid://kccji4f3l86p" path="res://ui/button/button_pressed.tres" id="5_fceyb"]
+[ext_resource type="FontFile" uid="uid://eb52ighl8mnl" path="res://assets/ui/04B_19.ttf" id="6_ibow1"]
+
+[resource]
+default_font = ExtResource("6_ibow1")
+default_font_size = 28
+Button/colors/font_color = Color(0.933333, 0.909804, 0.835294, 1)
+Button/colors/font_disabled_color = Color(0.513726, 0.580392, 0.588235, 1)
+Button/colors/font_focus_color = Color(0.992157, 0.964706, 0.890196, 1)
+Button/colors/font_hover_color = Color(0.992157, 0.964706, 0.890196, 1)
+Button/colors/font_hover_pressed_color = Color(0.992157, 0.964706, 0.890196, 1)
+Button/colors/font_outline_color = Color(0.992157, 0.964706, 0.890196, 1)
+Button/colors/font_pressed_color = Color(0.992157, 0.964706, 0.890196, 1)
+Button/font_sizes/font_size = 28
+Button/styles/disabled = ExtResource("1_kdwa2")
+Button/styles/focus = ExtResource("1_8x0ae")
+Button/styles/hover = ExtResource("3_kg542")
+Button/styles/normal = ExtResource("1_e241j")
+Button/styles/pressed = ExtResource("5_fceyb")
diff --git a/ui/start.tscn b/ui/start.tscn
new file mode 100644
index 0000000..8169c2f
--- /dev/null
+++ b/ui/start.tscn
@@ -0,0 +1,57 @@
+[gd_scene load_steps=4 format=3 uid="uid://bkyf7pxcw2ks3"]
+
+[ext_resource type="Theme" uid="uid://b5sr8elfovyw3" path="res://ui/main.theme.tres" id="1_gj4yg"]
+
+[sub_resource type="GDScript" id="GDScript_52jbq"]
+resource_name = "start"
+script/source = "extends Button
+
+func _pressed() -> void:
+ get_tree().change_scene_to_file(\"res://Main.tscn\")
+"
+
+[sub_resource type="GDScript" id="GDScript_vtoxm"]
+resource_name = "exit"
+script/source = "extends Button
+
+func _pressed() -> void:
+ get_tree().quit()
+"
+
+[node name="start" type="CenterContainer"]
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme = ExtResource("1_gj4yg")
+metadata/_edit_vertical_guides_ = []
+
+[node name="VBox" type="VBoxContainer" parent="."]
+layout_mode = 2
+offset_left = 74.0
+offset_top = 84.0
+offset_right = 246.0
+offset_bottom = 236.0
+
+[node name="StartButton" type="Button" parent="VBox"]
+layout_mode = 2
+offset_right = 172.0
+offset_bottom = 48.0
+text = "start"
+script = SubResource("GDScript_52jbq")
+
+[node name="CfgButtton" type="Button" parent="VBox"]
+layout_mode = 2
+offset_top = 52.0
+offset_right = 172.0
+offset_bottom = 100.0
+text = "configure"
+
+[node name="ExitButton" type="Button" parent="VBox"]
+layout_mode = 2
+offset_top = 104.0
+offset_right = 172.0
+offset_bottom = 152.0
+text = "<!) exit (!>"
+script = SubResource("GDScript_vtoxm")