Added triple wand

This commit is contained in:
Logan 2020-07-19 23:16:44 -05:00
parent 071e816c95
commit d057391c55
4 changed files with 28 additions and 4 deletions

19
magic/Wands/TripleWand.gd Normal file
View file

@ -0,0 +1,19 @@
extends Wand
func fire(projectile, effect):
if $ShootDelay.is_stopped() and projectile != null:
var temp1 = projectile.instance()
var temp2 = projectile.instance()
var temp3 = projectile.instance()
get_tree().current_scene.add_child(temp1)
get_tree().current_scene.add_child(temp2)
get_tree().current_scene.add_child(temp3)
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)
$ShootDelay.start()
return energy_cost

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://art/TripleWand.png" type="Texture" id=1]
[ext_resource path="res://magic/Wands/WandClass.gd" type="Script" id=2]
[ext_resource path="res://magic/Wands/TripleWand.gd" type="Script" id=2]
[node name="TripleWand" type="Sprite"]
position = Vector2( 2, -2 )
rotation = 1.5708
texture = ExtResource( 1 )
offset = Vector2( 0, -11 )
@ -11,12 +12,16 @@ script = ExtResource( 2 )
[node name="ProjectileSpawn1" type="Position2D" parent="."]
position = Vector2( -5.00007, -20 )
rotation = -1.64061
[node name="ProjectileSpawn2" type="Position2D" parent="."]
position = Vector2( -8.01086e-05, -22 )
rotation = -1.6057
[node name="ProjectileSpawn3" type="Position2D" parent="."]
position = Vector2( 4.99993, -20 )
rotation = -1.5708
[node name="ShootDelay" type="Timer" parent="."]
wait_time = 0.3
one_shot = true

View file

@ -1,5 +1,5 @@
extends Sprite
class_name Wands
class_name Wand
func fire(projectile, effect):
if $ShootDelay.is_stopped() and projectile != null:

View file

@ -30,7 +30,7 @@ _global_script_classes=[ {
"path": "res://script/StateMachine.gd"
}, {
"base": "Sprite",
"class": "Wands",
"class": "Wand",
"language": "GDScript",
"path": "res://magic/Wands/WandClass.gd"
} ]
@ -39,7 +39,7 @@ _global_script_class_icons={
"Enemy": "",
"Projectile": "",
"StateMachine": "",
"Wands": ""
"Wand": ""
}
[application]