diff --git a/Items/BounceWandCollectable.gd b/Items/BounceWandCollectable.gd deleted file mode 100644 index 34cdb88..0000000 --- a/Items/BounceWandCollectable.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Collectable - -func _on_Area2D_body_entered(body): - if body.get("Inventory") != null: - body.Inventory.add_item(Globals.Conduit3) - queue_free() diff --git a/Items/ChargeWandCollectable.gd b/Items/ChargeWandCollectable.gd deleted file mode 100644 index fafefaf..0000000 --- a/Items/ChargeWandCollectable.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Collectable - -func _on_Area2D_body_entered(body): - if body.get("Inventory") != null: - body.Inventory.add_item(Globals.Conduit1) - queue_free() diff --git a/Items/TripleWandPickup.gd b/Items/Collectable.gd similarity index 56% rename from Items/TripleWandPickup.gd rename to Items/Collectable.gd index 4b37b49..043b013 100644 --- a/Items/TripleWandPickup.gd +++ b/Items/Collectable.gd @@ -1,6 +1,9 @@ extends Area2D +class_name Collectable + +export var ID: int = 0 func _on_Area2D_body_entered(body): if body.get("Inventory") != null: - body.Inventory.add_item(Globals.Conduit2) + body.Inventory.add_item(ID) queue_free() diff --git a/Items/PrismWandPickup.gd b/Items/PrismWandPickup.gd deleted file mode 100644 index 54ba690..0000000 --- a/Items/PrismWandPickup.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Collectable - -func _on_Area2D_body_entered(body): - if body.get("Inventory") != null: - body.Inventory.add_item(Globals.Conduit4) - queue_free() diff --git a/Items/BounceWandCollectable.tscn b/Items/Wand Pickups/BounceWandCollectable.tscn similarity index 93% rename from Items/BounceWandCollectable.tscn rename to Items/Wand Pickups/BounceWandCollectable.tscn index b042cc1..4c2f766 100644 --- a/Items/BounceWandCollectable.tscn +++ b/Items/Wand Pickups/BounceWandCollectable.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://art/BouncingWand.png" type="Texture" id=1] -[ext_resource path="res://Items/BounceWandCollectable.gd" type="Script" id=2] +[ext_resource path="res://Items/Collectable.gd" type="Script" id=2] [sub_resource type="Animation" id=1] resource_name = "Bounce" @@ -27,6 +27,7 @@ radius = 9.05539 monitorable = false collision_layer = 0 script = ExtResource( 2 ) +ID = 2 [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) diff --git a/Items/ChargeWandPickup.tscn b/Items/Wand Pickups/ChargeWandPickup.tscn similarity index 93% rename from Items/ChargeWandPickup.tscn rename to Items/Wand Pickups/ChargeWandPickup.tscn index 40759c8..6da49bb 100644 --- a/Items/ChargeWandPickup.tscn +++ b/Items/Wand Pickups/ChargeWandPickup.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://Items/ChargeWandCollectable.gd" type="Script" id=1] +[ext_resource path="res://Items/Collectable.gd" type="Script" id=1] [ext_resource path="res://art/Wand.png" type="Texture" id=2] [sub_resource type="Animation" id=1] diff --git a/Items/PrismWandPickup.tscn b/Items/Wand Pickups/PrismWandPickup.tscn similarity index 93% rename from Items/PrismWandPickup.tscn rename to Items/Wand Pickups/PrismWandPickup.tscn index 3664215..35be063 100644 --- a/Items/PrismWandPickup.tscn +++ b/Items/Wand Pickups/PrismWandPickup.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://art/PrismaticWand.png" type="Texture" id=1] -[ext_resource path="res://Items/PrismWandPickup.gd" type="Script" id=2] +[ext_resource path="res://Items/Collectable.gd" type="Script" id=2] [sub_resource type="Animation" id=1] resource_name = "Bounce" @@ -27,6 +27,7 @@ radius = 9.05539 monitorable = false collision_layer = 0 script = ExtResource( 2 ) +ID = 3 [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) diff --git a/Items/TripleWandPickup.tscn b/Items/Wand Pickups/TripleWandPickup.tscn similarity index 93% rename from Items/TripleWandPickup.tscn rename to Items/Wand Pickups/TripleWandPickup.tscn index a1c63dd..a56c7d9 100644 --- a/Items/TripleWandPickup.tscn +++ b/Items/Wand Pickups/TripleWandPickup.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://Items/TripleWandPickup.gd" type="Script" id=1] +[ext_resource path="res://Items/Collectable.gd" type="Script" id=1] [ext_resource path="res://art/TripleWand.png" type="Texture" id=2] [sub_resource type="Animation" id=1] @@ -27,6 +27,7 @@ radius = 9.05539 monitorable = false collision_layer = 0 script = ExtResource( 1 ) +ID = 1 [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 2 ) diff --git a/levels/World.tscn b/levels/World.tscn index bb929dc..133843d 100644 --- a/levels/World.tscn +++ b/levels/World.tscn @@ -7,10 +7,12 @@ [ext_resource path="res://script/typewriter.gd" type="Script" id=5] [ext_resource path="res://Music and Fonts(Misc.)/Keb3q1.png" type="Texture" id=6] [ext_resource path="res://art/Pedestal.png" type="Texture" id=7] -[ext_resource path="res://Items/ChargeWandPickup.tscn" type="PackedScene" id=8] +[ext_resource path="res://Items/Wand Pickups/ChargeWandPickup.tscn" type="PackedScene" id=8] [ext_resource path="res://art/ecoprojectile.png" type="Texture" id=9] [ext_resource path="res://art/Mana.png" type="Texture" id=12] -[ext_resource path="res://Items/Door.tscn" type="PackedScene" id=13] +[ext_resource path="res://objects/Door.tscn" type="PackedScene" id=13] + + [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 169.977, 24.8286 ) diff --git a/levels/test.tscn b/levels/test.tscn index 61ca700..06267cd 100644 --- a/levels/test.tscn +++ b/levels/test.tscn @@ -1,8 +1,12 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2] [ext_resource path="res://ai/ogre.tscn" type="PackedScene" id=3] +[ext_resource path="res://Items/Wand Pickups/ChargeWandPickup.tscn" type="PackedScene" id=4] +[ext_resource path="res://Items/Wand Pickups/TripleWandPickup.tscn" type="PackedScene" id=5] +[ext_resource path="res://Items/Wand Pickups/BounceWandCollectable.tscn" type="PackedScene" id=6] +[ext_resource path="res://Items/Wand Pickups/PrismWandPickup.tscn" type="PackedScene" id=7] [node name="Node2D" type="Node2D"] @@ -17,3 +21,15 @@ position = Vector2( 286, 170 ) [node name="Ogre2" parent="." instance=ExtResource( 3 )] position = Vector2( 347, 159 ) + +[node name="PrismWandPickup" parent="." instance=ExtResource( 7 )] +position = Vector2( 189, 151 ) + +[node name="ChargeWandPickup" parent="PrismWandPickup" instance=ExtResource( 4 )] +position = Vector2( -98, -9 ) + +[node name="TripleWand" parent="PrismWandPickup" instance=ExtResource( 5 )] +position = Vector2( -64, -9 ) + +[node name="BounceWandPickup" parent="PrismWandPickup" instance=ExtResource( 6 )] +position = Vector2( -33, -6 ) diff --git a/magic/Wands/ChargedWand.gd b/magic/Wands/ChargedWand.gd index 615ca14..cfeb33a 100644 --- a/magic/Wands/ChargedWand.gd +++ b/magic/Wands/ChargedWand.gd @@ -10,9 +10,15 @@ func fire(p): projectile = p if ChargeTimer.is_stopped(): ChargeTimer.start() + if charge_level == 0: + var temp = p.instance() + get_tree().current_scene.add_child(temp) + var energy = temp.energy_cost + print(energy) + temp.queue_free() + return energy * 2 func _process(delta): - print(charge_level) scale = Vector2(charge_level / 2 + 1, charge_level / 2 + 1) func _on_ChargeTimer_timeout(): diff --git a/Items/Door Animation.tscn b/meta/Door Animation.tscn similarity index 100% rename from Items/Door Animation.tscn rename to meta/Door Animation.tscn diff --git a/Area2D.gd b/objects/Area2D.gd similarity index 100% rename from Area2D.gd rename to objects/Area2D.gd diff --git a/Items/Door.tscn b/objects/Door.tscn similarity index 83% rename from Items/Door.tscn rename to objects/Door.tscn index a67b79f..05e9068 100644 --- a/Items/Door.tscn +++ b/objects/Door.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://art/door.png" type="Texture" id=1] -[ext_resource path="res://Area2D.gd" type="Script" id=2] +[ext_resource path="res://objects/Area2D.gd" type="Script" id=1] +[ext_resource path="res://art/door.png" type="Texture" id=2] [sub_resource type="Animation" id=1] resource_name = "Door Opening" @@ -23,7 +23,7 @@ tracks/0/keys = { extents = Vector2( 14, 13 ) [node name="Door" type="Sprite"] -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) centered = false hframes = 2 frame = 1 @@ -32,7 +32,7 @@ frame = 1 "anims/Door Opening" = SubResource( 1 ) [node name="Area2D" type="Area2D" parent="."] -script = ExtResource( 2 ) +script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] position = Vector2( 16, 19 ) diff --git a/project.godot b/project.godot index f3c8e77..55dfb60 100644 --- a/project.godot +++ b/project.godot @@ -17,7 +17,7 @@ _global_script_classes=[ { "base": "Area2D", "class": "Collectable", "language": "GDScript", -"path": "res://script/ItemPickup.gd" +"path": "res://Items/Collectable.gd" }, { "base": "KinematicBody2D", "class": "Enemy", diff --git a/script/ItemPickup.gd b/script/ItemPickup.gd deleted file mode 100644 index 0d81705..0000000 --- a/script/ItemPickup.gd +++ /dev/null @@ -1,7 +0,0 @@ -extends Area2D -class_name Collectable - -export var Item: PackedScene - -func _on_Area2D_body_entered(body): - queue_free() diff --git a/script/basic_wand_collectable.gd b/script/basic_wand_collectable.gd deleted file mode 100644 index fafefaf..0000000 --- a/script/basic_wand_collectable.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Collectable - -func _on_Area2D_body_entered(body): - if body.get("Inventory") != null: - body.Inventory.add_item(Globals.Conduit1) - queue_free() diff --git a/ui/Inventory.tscn b/ui/Inventory.tscn index 3125b3c..8932259 100644 --- a/ui/Inventory.tscn +++ b/ui/Inventory.tscn @@ -58,6 +58,7 @@ texture = ExtResource( 1 ) [node name="Conduits" type="Node2D" parent="Inventory"] [node name="Conduit1" type="TextureButton" parent="Inventory/Conduits"] +visible = false light_mask = -2147483647 margin_left = -47.0 margin_top = -30.0 @@ -76,6 +77,7 @@ __meta__ = { position = Vector2( 7, 9 ) [node name="Conduit2" type="TextureButton" parent="Inventory/Conduits"] +visible = false light_mask = -2147483647 margin_left = -26.0 margin_top = -30.0 @@ -93,6 +95,7 @@ __meta__ = { position = Vector2( 9, 9 ) [node name="Conduit3" type="TextureButton" parent="Inventory/Conduits"] +visible = false light_mask = -2147483647 margin_left = -49.0 margin_top = -6.0 @@ -110,6 +113,7 @@ __meta__ = { position = Vector2( 9, 10 ) [node name="Conduit4" type="TextureButton" parent="Inventory/Conduits"] +visible = false light_mask = -2147483647 margin_left = -24.0 margin_top = -6.0