Added triple wand
This commit is contained in:
parent
071e816c95
commit
d057391c55
19
magic/Wands/TripleWand.gd
Normal file
19
magic/Wands/TripleWand.gd
Normal 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
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://art/TripleWand.png" type="Texture" id=1]
|
[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"]
|
[node name="TripleWand" type="Sprite"]
|
||||||
|
position = Vector2( 2, -2 )
|
||||||
rotation = 1.5708
|
rotation = 1.5708
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 1 )
|
||||||
offset = Vector2( 0, -11 )
|
offset = Vector2( 0, -11 )
|
||||||
|
@ -11,12 +12,16 @@ script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="ProjectileSpawn1" type="Position2D" parent="."]
|
[node name="ProjectileSpawn1" type="Position2D" parent="."]
|
||||||
position = Vector2( -5.00007, -20 )
|
position = Vector2( -5.00007, -20 )
|
||||||
|
rotation = -1.64061
|
||||||
|
|
||||||
[node name="ProjectileSpawn2" type="Position2D" parent="."]
|
[node name="ProjectileSpawn2" type="Position2D" parent="."]
|
||||||
position = Vector2( -8.01086e-05, -22 )
|
position = Vector2( -8.01086e-05, -22 )
|
||||||
|
rotation = -1.6057
|
||||||
|
|
||||||
[node name="ProjectileSpawn3" type="Position2D" parent="."]
|
[node name="ProjectileSpawn3" type="Position2D" parent="."]
|
||||||
position = Vector2( 4.99993, -20 )
|
position = Vector2( 4.99993, -20 )
|
||||||
|
rotation = -1.5708
|
||||||
|
|
||||||
[node name="ShootDelay" type="Timer" parent="."]
|
[node name="ShootDelay" type="Timer" parent="."]
|
||||||
wait_time = 0.3
|
wait_time = 0.3
|
||||||
|
one_shot = true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
extends Sprite
|
extends Sprite
|
||||||
class_name Wands
|
class_name Wand
|
||||||
|
|
||||||
func fire(projectile, effect):
|
func fire(projectile, effect):
|
||||||
if $ShootDelay.is_stopped() and projectile != null:
|
if $ShootDelay.is_stopped() and projectile != null:
|
||||||
|
|
|
@ -30,7 +30,7 @@ _global_script_classes=[ {
|
||||||
"path": "res://script/StateMachine.gd"
|
"path": "res://script/StateMachine.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Sprite",
|
"base": "Sprite",
|
||||||
"class": "Wands",
|
"class": "Wand",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://magic/Wands/WandClass.gd"
|
"path": "res://magic/Wands/WandClass.gd"
|
||||||
} ]
|
} ]
|
||||||
|
@ -39,7 +39,7 @@ _global_script_class_icons={
|
||||||
"Enemy": "",
|
"Enemy": "",
|
||||||
"Projectile": "",
|
"Projectile": "",
|
||||||
"StateMachine": "",
|
"StateMachine": "",
|
||||||
"Wands": ""
|
"Wand": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
Loading…
Reference in a new issue