From 39157a605ea281aa0be46545edee8b4a225008b8 Mon Sep 17 00:00:00 2001 From: Logan Date: Sat, 18 Jul 2020 00:07:44 -0500 Subject: [PATCH] Retextured UI --- ItemPickup.gd | 3 --- Items/Basic Wand Pickup.tscn | 41 ++++++++++++++++++++++++++++++++ levels/test.tscn | 11 ++++++++- script/ItemPickup.gd | 6 +++++ script/player.gd | 1 - ui/Inventory.png | Bin 0 -> 1262 bytes ui/Inventory.png.import | 34 ++++++++++++++++++++++++++ ui/Player UI Frame 2.png | Bin 0 -> 506 bytes ui/Player UI Frame 2.png.import | 34 ++++++++++++++++++++++++++ ui/PlayerStats.gd | 6 ++--- ui/PlayerStats.tscn | 37 ++++++++++++++++------------ 11 files changed, 150 insertions(+), 23 deletions(-) delete mode 100644 ItemPickup.gd create mode 100644 Items/Basic Wand Pickup.tscn create mode 100644 script/ItemPickup.gd create mode 100644 ui/Inventory.png create mode 100644 ui/Inventory.png.import create mode 100644 ui/Player UI Frame 2.png create mode 100644 ui/Player UI Frame 2.png.import diff --git a/ItemPickup.gd b/ItemPickup.gd deleted file mode 100644 index 8efb11b..0000000 --- a/ItemPickup.gd +++ /dev/null @@ -1,3 +0,0 @@ -extends Node - - diff --git a/Items/Basic Wand Pickup.tscn b/Items/Basic Wand Pickup.tscn new file mode 100644 index 0000000..054a98e --- /dev/null +++ b/Items/Basic Wand Pickup.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://art/Wand.png" type="Texture" id=1] +[ext_resource path="res://script/ItemPickup.gd" type="Script" id=2] + +[sub_resource type="Animation" id=1] +resource_name = "Bounce" +length = 2.0 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("Wand Pickup:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.5, 1.5 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 0, 0 ), Vector2( 0, 2 ), Vector2( 0, -2 ) ] +} + +[sub_resource type="CircleShape2D" id=2] +radius = 9.05539 + +[node name="Area2D" type="Area2D"] +monitorable = false +collision_layer = 0 +script = ExtResource( 2 ) + +[node name="Wand Pickup" type="Sprite" parent="."] +position = Vector2( 0, 0.853822 ) +texture = ExtResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "Bounce" +anims/Bounce = SubResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) +[connection signal="body_entered" from="." to="." method="_on_Area2D_body_entered"] diff --git a/levels/test.tscn b/levels/test.tscn index 27c3693..2f4f4e6 100644 --- a/levels/test.tscn +++ b/levels/test.tscn @@ -1,10 +1,19 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://characters/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2] +[ext_resource path="res://Items/Basic Wand Pickup.tscn" type="PackedScene" id=3] +[ext_resource path="res://art/Pedestal.png" type="Texture" id=4] [node name="Node2D" type="Node2D"] +[node name="Pedestal" type="Sprite" parent="."] +position = Vector2( 98, 168 ) +texture = ExtResource( 4 ) + +[node name="Wand Pickup" parent="Pedestal" instance=ExtResource( 3 )] +position = Vector2( 0, -12 ) + [node name="Player" parent="." instance=ExtResource( 1 )] position = Vector2( 60, 176 ) diff --git a/script/ItemPickup.gd b/script/ItemPickup.gd new file mode 100644 index 0000000..eeaccb0 --- /dev/null +++ b/script/ItemPickup.gd @@ -0,0 +1,6 @@ +extends Area2D + +export var Item: PackedScene + +func _on_Area2D_body_entered(body): + print(body) diff --git a/script/player.gd b/script/player.gd index 5cda024..46878b6 100644 --- a/script/player.gd +++ b/script/player.gd @@ -54,7 +54,6 @@ func _ready(): func _physics_process(delta): Globals.player = position - print(Globals.player) emit_signal("grounded_updated", is_on_floor()) diff --git a/ui/Inventory.png b/ui/Inventory.png new file mode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5Q1$zdbKWJnwFw{2*I`8)QrX;~gQu7sH2 YAA9OlFj>ONUjP6A07*qoM6N<$g8HLXO#lD@ literal 0 HcmV?d00001 diff --git a/ui/Inventory.png.import b/ui/Inventory.png.import new file mode 100644 index 0000000..fc051c2 --- /dev/null +++ b/ui/Inventory.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Inventory.png-43b1effbb274feadb5a883f6a0af2730.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/Inventory.png" +dest_files=[ "res://.import/Inventory.png-43b1effbb274feadb5a883f6a0af2730.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 +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/ui/Player UI Frame 2.png b/ui/Player UI Frame 2.png new file mode 100644 index 0000000000000000000000000000000000000000..35e4287d4d8299374d1594452433142ebccd3392 GIT binary patch literal 506 zcmVPx$v`IukRA_hIa$H2x~f0RS(La6VnkQDwR8WJur?Bo&j}j{w1HEw9TYzS$03zo9Pt zzWuv`V~~IjfeKb@%$6H@U!)PrB-XZbtGC&5aS%~W!r4IL6Jt<_U4MG zr&{c>9WmA=D??}k6i1gD$8*QPj-P4 z9d@Z%xblYv5h&}dPke@4MWW^p6;A1SUy+`{AHspK%^3e}9i_`+xxn_6UY_-Fo>U)j wo|kTHZHvqU#$WNA@bmqN*Y}UBwz{spUr#tmt|=ol(f|Me07*qoM6N<$f=tZt5dZ)H literal 0 HcmV?d00001 diff --git a/ui/Player UI Frame 2.png.import b/ui/Player UI Frame 2.png.import new file mode 100644 index 0000000..e4d74e0 --- /dev/null +++ b/ui/Player UI Frame 2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Player UI Frame 2.png-ae7c7823c7da329b4570ee5d7763efe6.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/Player UI Frame 2.png" +dest_files=[ "res://.import/Player UI Frame 2.png-ae7c7823c7da329b4570ee5d7763efe6.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 +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/ui/PlayerStats.gd b/ui/PlayerStats.gd index 3dad944..904c337 100644 --- a/ui/PlayerStats.gd +++ b/ui/PlayerStats.gd @@ -1,11 +1,11 @@ extends CanvasLayer -onready var Hearts: TextureProgress = $"Player UI Frame/Hearts" -onready var Energybar: TextureProgress = $"Player UI Frame/Energy" +onready var Hearts: TextureProgress = $"Player UI Frame 2/Hearts" +onready var Energybar: TextureProgress = $"Player UI Frame 2/Energy" onready var Regen: Timer = $Regen var health = 3 setget set_health, get_health -var energy = 0 setget set_energy, get_energy +var energy = 5 setget set_energy, get_energy func _on_Regen_timeout(): set_energy(get_energy() + 1) diff --git a/ui/PlayerStats.tscn b/ui/PlayerStats.tscn index 3e04d88..0609f29 100644 --- a/ui/PlayerStats.tscn +++ b/ui/PlayerStats.tscn @@ -1,36 +1,43 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://ui/PlayerStats.gd" type="Script" id=1] -[ext_resource path="res://ui/Player UI Frame.png" type="Texture" id=2] +[ext_resource path="res://ui/Player UI Frame 2.png" type="Texture" id=2] [ext_resource path="res://ui/Hearts.png" type="Texture" id=3] [ext_resource path="res://ui/Energy.png" type="Texture" id=4] [node name="Stats" type="CanvasLayer"] script = ExtResource( 1 ) -[node name="Player UI Frame" type="Sprite" parent="."] -position = Vector2( 160, 171 ) +[node name="Regen" type="Timer" parent="."] +wait_time = 0.5 +one_shot = true + +[node name="Player UI Frame 2" type="Sprite" parent="."] +position = Vector2( 160, 170 ) texture = ExtResource( 2 ) -[node name="Hearts" type="TextureProgress" parent="Player UI Frame"] -margin_left = -45.0 +[node name="Hearts" type="TextureProgress" parent="Player UI Frame 2"] +margin_left = -47.0 margin_top = -6.0 -margin_right = 2.0 margin_bottom = 6.0 max_value = 3.0 step = 0.5 value = 3.0 texture_progress = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} -[node name="Energy" type="TextureProgress" parent="Player UI Frame"] -margin_left = 6.0 -margin_top = -5.0 -margin_right = 44.0 -margin_bottom = 4.0 +[node name="Energy" type="TextureProgress" parent="Player UI Frame 2"] +margin_left = 4.0 +margin_top = -4.99998 +margin_right = 42.0 +margin_bottom = 4.00002 max_value = 5.0 +step = 1.0 +value = 5.0 texture_progress = ExtResource( 4 ) - -[node name="Regen" type="Timer" parent="."] -wait_time = 0.5 -one_shot = true +__meta__ = { +"_edit_use_anchors_": false +} [connection signal="timeout" from="Regen" to="." method="_on_Regen_timeout"]