work on wands

This commit is contained in:
Logan 2020-07-20 16:36:28 -05:00
parent 24778c18e1
commit 2b26e3fba0
19 changed files with 151 additions and 27 deletions

View file

@ -15,6 +15,6 @@ func get_type():
func apply_gravity(delta, modifier = 1):
velocity.y += gravity * delta * modifier
if is_on_wall() and is_on_floor():
velocity.y = -150

34
art/door.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/door.png-7e406854813fcf118164bcf195a745da.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/door.png"
dest_files=[ "res://.import/door.png-7e406854813fcf118164bcf195a745da.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

View file

@ -1,8 +1,7 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 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/TripleWandPickup.tscn" type="PackedScene" id=3]
[ext_resource path="res://ai/Skeleton Enemy.tscn" type="PackedScene" id=4]
[node name="Node2D" type="Node2D"]
@ -13,8 +12,5 @@ tile_data = PoolIntArray( 65536, 0, 8, 65537, 0, 10, 65538, 0, 10, 65539, 0, 10,
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 60, 176 )
[node name="TripleWand" parent="." instance=ExtResource( 3 )]
position = Vector2( 67, 168 )
[node name="Skeleton Enemy" parent="." instance=ExtResource( 4 )]
position = Vector2( 274, 164 )

View file

@ -3,3 +3,4 @@ extends Projectile
func _ready():
energy_cost = 0
damage = 0.5

View file

@ -4,7 +4,7 @@
[ext_resource path="res://magic/Projectiles/EcoProjectile.gd" type="Script" id=2]
[sub_resource type="CircleShape2D" id=1]
radius = 5.09902
radius = 6.08276
[node name="EcoProjectile" type="KinematicBody2D"]
collision_layer = 8
@ -12,6 +12,7 @@ collision_mask = 6
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 1.5, 1.5 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View file

@ -2,8 +2,21 @@ extends Projectile
func _ready():
damage = 3
energy_cost = 5
func on_impact(collision):
if collision.collider.has_method("get_type") && collision.collider.get_type() == "enemy":
var c = collision.collider
c.health -= damage * damage_mod
explode()
elif bounces_left != 0:
bounces_left -= 1
look_at(position + velocity.bounce(collision.normal))
launch(null, null)
else:
explode()
func explode():
for body in $Area2D.get_overlapping_bodies():
if body.get("health") != null and body.get_type() != "player":
body.health -= damage

View file

@ -4,7 +4,7 @@
[ext_resource path="res://magic/Projectiles/ExplosiveProjectile.gd" type="Script" id=2]
[sub_resource type="CircleShape2D" id=1]
radius = 4.12311
radius = 6.0
[sub_resource type="Gradient" id=3]
offsets = PoolRealArray( 0.0120482, 0.192771, 0.534137, 1 )
@ -34,6 +34,7 @@ script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
rotation = 0.785398
scale = Vector2( 1.5, 1.5 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@ -48,9 +49,9 @@ explosiveness = 0.8
process_material = SubResource( 5 )
[node name="Area2D" type="Area2D" parent="."]
visible = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
visible = false
shape = SubResource( 2 )
[node name="KillTimer" type="Timer" parent="."]

View file

@ -3,7 +3,11 @@ extends Projectile
var ignore = []
func _ready():
energy_cost = 3
damage = 1
func _on_body_entered(body):
if body.get("health") != null:
body.health -= 1
body.health -= damage * damage_mod

View file

@ -3,12 +3,12 @@
[ext_resource path="res://art/PhantomProjectile.png" type="Texture" id=1]
[ext_resource path="res://magic/Projectiles/PhantomProjectile.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 1, 4 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 3, 6 )
[sub_resource type="CapsuleShape2D" id=2]
radius = 3.0
height = 6.0
radius = 4.0
height = 7.99999
[node name="PhantomProjectile" type="KinematicBody2D"]
collision_layer = 8
@ -16,12 +16,12 @@ collision_mask = 2
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 1.5, 1.5 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
rotation = 1.5708
shape = SubResource( 1 )
shape = SubResource( 3 )
[node name="Area2D" type="Area2D" parent="."]
monitorable = false

View file

@ -6,6 +6,32 @@ var velocity = Vector2.ZERO
var energy_cost = 1
var damage = 1
var damage_mod = 1
var energy_mod = 1
var bounces_left = 0
var is_bounce = false
var is_charge = false
var is_prism = false
var is_triple = false
func get_wand_type(wand_id):
match wand_id:
Globals.Conduit1:
is_charge = true
print("charge")
Globals.Conduit2:
is_triple = true
print("triple")
var damage_mod = 0.75
Globals.Conduit3:
is_bounce = true
print("bounce")
bounces_left = 1
Globals.Conduit4:
print("prism")
is_prism = true
func _physics_process(delta):
var collision = move_and_collide(velocity * delta)
if collision != null:
@ -13,10 +39,17 @@ func _physics_process(delta):
func launch(wand, effect):
velocity = (Vector2(speed, 0)).rotated(rotation)
return energy_cost
get_wand_type(wand)
return energy_cost * energy_mod
func on_impact(collision):
if collision.collider.has_method("get_type") && collision.collider.get_type() == "enemy":
var c = collision.collider
c.health -= damage
queue_free()
c.health -= damage * damage_mod
queue_free()
elif bounces_left != 0:
bounces_left -= 1
look_at(position + velocity.bounce(collision.normal))
launch(null, null)
else:
queue_free()

View file

@ -0,0 +1,5 @@
extends Projectile
func _ready():
energy_cost = 2
damage = 1

View file

@ -1,10 +1,10 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://art/WaveProjectile.png" type="Texture" id=1]
[ext_resource path="res://magic/Projectiles/Projectile.gd" type="Script" id=2]
[ext_resource path="res://magic/Projectiles/WaveProjectile.gd" type="Script" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 4.0
radius = 5.0
height = 4.0
[node name="WaveProjectile" type="KinematicBody2D"]
@ -13,7 +13,9 @@ collision_mask = 6
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 1.5, 1.5 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( -1, 0 )
shape = SubResource( 1 )

View file

@ -0,0 +1,4 @@
extends Wand
func _ready():
wand_type = Globals.Conduit3

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://art/BouncingWand.png" type="Texture" id=1]
[ext_resource path="res://magic/Wands/WandClass.gd" type="Script" id=2]
[ext_resource path="res://magic/Wands/BouncyWand.gd" type="Script" id=2]
[node name="BouncyWand" type="Sprite"]
rotation = 1.5708

View file

@ -0,0 +1,16 @@
extends Sprite
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View file

@ -1,5 +1,8 @@
extends Wand
func _ready():
wand_type = Globals.Conduit2
func fire(projectile, effect):
if $ShootDelay.is_stopped() and projectile != null:
var temp1 = projectile.instance()
@ -11,8 +14,8 @@ func fire(projectile, effect):
temp1.global_transform = $ProjectileSpawn1.global_transform
temp2.global_transform = $ProjectileSpawn2.global_transform
temp3.global_transform = $ProjectileSpawn3.global_transform
var energy_cost = temp1.launch(null, null)
temp2.launch(null, null)
temp3.launch(null, null)
var energy_cost = temp1.launch(wand_type, effect_type)
energy_cost += temp2.launch(wand_type, effect_type)
energy_cost += temp3.launch(wand_type, effect_type)
$ShootDelay.start()
return energy_cost

View file

@ -1,11 +1,13 @@
extends Sprite
class_name Wand
var wand_type
var effect_type
func fire(projectile, effect):
if $ShootDelay.is_stopped() and projectile != null:
var temp = projectile.instance()
get_tree().current_scene.add_child(temp)
temp.global_transform = $ProjectileSpawn.global_transform
var energy_cost = temp.launch(null, null)
var energy_cost = temp.launch(wand_type, effect_type)
$ShootDelay.start()
return energy_cost

View file

@ -103,6 +103,15 @@ texture={
[input]
ui_accept={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null)
]
}
ui_end={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777230,"unicode":0,"echo":false,"script":null)

View file

@ -10,7 +10,7 @@
script = ExtResource( 1 )
[node name="Regen" type="Timer" parent="."]
wait_time = 0.5
wait_time = 0.2
one_shot = true
[node name="Player UI Frame 2" type="Sprite" parent="."]