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 100644 index 0000000..e7bc4bf Binary files /dev/null and b/ui/Inventory.png differ 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 0000000..35e4287 Binary files /dev/null and b/ui/Player UI Frame 2.png differ 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"]