Fixed charge wand not using energy

This commit is contained in:
Logan 2020-07-21 20:06:39 -05:00
parent ee24fa5352
commit 56572e1caa
18 changed files with 48 additions and 45 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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 )

View file

@ -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]

View file

@ -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 )

View file

@ -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 )

View file

@ -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 )

View file

@ -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 )

View file

@ -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():

View file

@ -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 )

View file

@ -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",

View file

@ -1,7 +0,0 @@
extends Area2D
class_name Collectable
export var Item: PackedScene
func _on_Area2D_body_entered(body):
queue_free()

View file

@ -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()

View file

@ -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