Explosive projectile works with prism
This commit is contained in:
parent
6b52d24e74
commit
c77e5f9dcb
|
@ -7,6 +7,7 @@ var energy_cost = 1
|
||||||
var max_cast = Vector2(400, 0)
|
var max_cast = Vector2(400, 0)
|
||||||
|
|
||||||
func get_collider():
|
func get_collider():
|
||||||
|
$FireSound.play(0.0)
|
||||||
return $RayCast2D.get_collider()
|
return $RayCast2D.get_collider()
|
||||||
|
|
||||||
func activate():
|
func activate():
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://magic/Beams/EcoBeam.png" type="Texture" id=1]
|
[ext_resource path="res://magic/Beams/EcoBeam.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://magic/Beams/EcoBeam.gd" type="Script" id=2]
|
[ext_resource path="res://magic/Beams/EcoBeam.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://Sound Effects/EcoProjectile.wav" type="AudioStream" id=3]
|
||||||
|
|
||||||
[node name="EcoBeam" type="Node2D"]
|
[node name="EcoBeam" type="Node2D"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
@ -21,3 +22,6 @@ cast_to = Vector2( 400, 0 )
|
||||||
collision_mask = 6
|
collision_mask = 6
|
||||||
|
|
||||||
[node name="End" type="Position2D" parent="."]
|
[node name="End" type="Position2D" parent="."]
|
||||||
|
|
||||||
|
[node name="FireSound" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
stream = ExtResource( 3 )
|
||||||
|
|
|
@ -3,3 +3,21 @@ extends Beam
|
||||||
func _ready():
|
func _ready():
|
||||||
damage = 3
|
damage = 3
|
||||||
energy_cost = 5
|
energy_cost = 5
|
||||||
|
|
||||||
|
func activate():
|
||||||
|
$Beam.visible = true
|
||||||
|
$RayCast2D.enabled = true
|
||||||
|
$End/Area2D.monitoring = true
|
||||||
|
|
||||||
|
func deactivate():
|
||||||
|
$Beam.visible = false
|
||||||
|
$RayCast2D.enabled = false
|
||||||
|
$End/Area2D.monitoring = false
|
||||||
|
|
||||||
|
func get_collider():
|
||||||
|
$FireSound.play(0.0)
|
||||||
|
$End/Particles2D.emitting = true
|
||||||
|
var r = []
|
||||||
|
for b in $End/Area2D.get_overlapping_bodies():
|
||||||
|
r.append(b)
|
||||||
|
return r
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://magic/Beams/ExplosiveBeam.gd" type="Script" id=1]
|
[ext_resource path="res://magic/Beams/ExplosiveBeam.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://magic/Beams/ExplosiveBeam.png" type="Texture" id=2]
|
[ext_resource path="res://magic/Beams/ExplosiveBeam.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://Sound Effects/Explosion.wav" type="AudioStream" id=3]
|
||||||
|
[ext_resource path="res://magic/ExplosionParticles.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
|
radius = 50.0
|
||||||
|
|
||||||
[node name="ExplosiveBeam" type="Node2D"]
|
[node name="ExplosiveBeam" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -21,3 +26,17 @@ cast_to = Vector2( 400, 0 )
|
||||||
collision_mask = 6
|
collision_mask = 6
|
||||||
|
|
||||||
[node name="End" type="Position2D" parent="."]
|
[node name="End" type="Position2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="End"]
|
||||||
|
monitorable = false
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="End/Area2D"]
|
||||||
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="Particles2D" parent="End" instance=ExtResource( 4 )]
|
||||||
|
one_shot = false
|
||||||
|
|
||||||
|
[node name="FireSound" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
stream = ExtResource( 3 )
|
||||||
|
|
|
@ -9,17 +9,18 @@ func activate():
|
||||||
$RayCast2D.enabled = true
|
$RayCast2D.enabled = true
|
||||||
$Area2D.monitoring = true
|
$Area2D.monitoring = true
|
||||||
|
|
||||||
func get_collider():
|
|
||||||
var r = []
|
|
||||||
for b in $Area2D.get_overlapping_bodies():
|
|
||||||
r.append(b)
|
|
||||||
return r
|
|
||||||
|
|
||||||
func deactivate():
|
func deactivate():
|
||||||
$Beam.visible = false
|
$Beam.visible = false
|
||||||
$RayCast2D.enabled = false
|
$RayCast2D.enabled = false
|
||||||
$Area2D.monitoring = false
|
$Area2D.monitoring = false
|
||||||
|
|
||||||
|
func get_collider():
|
||||||
|
$FireSound.play(0.0)
|
||||||
|
var r = []
|
||||||
|
for b in $Area2D.get_overlapping_bodies():
|
||||||
|
r.append(b)
|
||||||
|
return r
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
$RayCast2D.cast_to = max_cast
|
$RayCast2D.cast_to = max_cast
|
||||||
if $RayCast2D.is_colliding():
|
if $RayCast2D.is_colliding():
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://magic/Beams/PhantomBeam.png" type="Texture" id=1]
|
[ext_resource path="res://magic/Beams/PhantomBeam.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://magic/Beams/PhantomBeam.gd" type="Script" id=2]
|
[ext_resource path="res://magic/Beams/PhantomBeam.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://Sound Effects/PhantomProjectile.wav" type="AudioStream" id=3]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 4, 4 )
|
extents = Vector2( 4, 4 )
|
||||||
|
@ -34,3 +35,6 @@ collision_mask = 4
|
||||||
modulate = Color( 0.945313, 1, 0, 1 )
|
modulate = Color( 0.945313, 1, 0, 1 )
|
||||||
position = Vector2( 4, 0 )
|
position = Vector2( 4, 0 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="FireSound" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
stream = ExtResource( 3 )
|
||||||
|
|
|
@ -5,6 +5,7 @@ func _ready():
|
||||||
damage = 1
|
damage = 1
|
||||||
|
|
||||||
func get_collider():
|
func get_collider():
|
||||||
|
$FireSound.play(0.0)
|
||||||
var c = $RayCast2D.get_collider()
|
var c = $RayCast2D.get_collider()
|
||||||
if c != null and c.has_method("get_type") and c.get_type() == "enemy":
|
if c != null and c.has_method("get_type") and c.get_type() == "enemy":
|
||||||
print("knock")
|
print("knock")
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://magic/Beams/WaveBeam.gd" type="Script" id=1]
|
[ext_resource path="res://magic/Beams/WaveBeam.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://magic/Beams/KnockbackBeam.png" type="Texture" id=2]
|
[ext_resource path="res://magic/Beams/KnockbackBeam.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://Sound Effects/WaveProjectile.wav" type="AudioStream" id=3]
|
||||||
|
|
||||||
[node name="WaveBeam" type="Node2D"]
|
[node name="WaveBeam" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -21,3 +22,6 @@ cast_to = Vector2( 400, 0 )
|
||||||
collision_mask = 6
|
collision_mask = 6
|
||||||
|
|
||||||
[node name="End" type="Position2D" parent="."]
|
[node name="End" type="Position2D" parent="."]
|
||||||
|
|
||||||
|
[node name="FireSound" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
stream = ExtResource( 3 )
|
||||||
|
|
27
magic/ExplosionParticles.tscn
Normal file
27
magic/ExplosionParticles.tscn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id=2]
|
||||||
|
offsets = PoolRealArray( 0.0120482, 0.192771, 0.534137, 1 )
|
||||||
|
colors = PoolColorArray( 1, 0.449219, 0.449219, 1, 1, 0, 0, 1, 1, 0.351563, 0, 1, 0.155762, 0.155762, 0.155762, 1 )
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture" id=3]
|
||||||
|
gradient = SubResource( 2 )
|
||||||
|
|
||||||
|
[sub_resource type="ParticlesMaterial" id=4]
|
||||||
|
emission_shape = 1
|
||||||
|
emission_sphere_radius = 1.0
|
||||||
|
flag_disable_z = true
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector3( 0, 0, 0 )
|
||||||
|
initial_velocity = 50.0
|
||||||
|
orbit_velocity = 0.0
|
||||||
|
orbit_velocity_random = 0.0
|
||||||
|
color_ramp = SubResource( 3 )
|
||||||
|
|
||||||
|
[node name="Particles2D" type="Particles2D"]
|
||||||
|
emitting = false
|
||||||
|
amount = 200
|
||||||
|
one_shot = true
|
||||||
|
speed_scale = 2.5
|
||||||
|
explosiveness = 0.8
|
||||||
|
process_material = SubResource( 4 )
|
|
@ -1,30 +1,13 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://art/MineProjectile.png" type="Texture" id=1]
|
[ext_resource path="res://art/MineProjectile.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://magic/Projectiles/ExplosiveProjectile.gd" type="Script" id=2]
|
[ext_resource path="res://magic/Projectiles/ExplosiveProjectile.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://Sound Effects/Explosion.wav" type="AudioStream" id=3]
|
[ext_resource path="res://Sound Effects/Explosion.wav" type="AudioStream" id=3]
|
||||||
|
[ext_resource path="res://magic/ExplosionParticles.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 6.0
|
radius = 6.0
|
||||||
|
|
||||||
[sub_resource type="Gradient" id=2]
|
|
||||||
offsets = PoolRealArray( 0.0120482, 0.192771, 0.534137, 1 )
|
|
||||||
colors = PoolColorArray( 1, 0.449219, 0.449219, 1, 1, 0, 0, 1, 1, 0.351563, 0, 1, 0.155762, 0.155762, 0.155762, 1 )
|
|
||||||
|
|
||||||
[sub_resource type="GradientTexture" id=3]
|
|
||||||
gradient = SubResource( 2 )
|
|
||||||
|
|
||||||
[sub_resource type="ParticlesMaterial" id=4]
|
|
||||||
emission_shape = 1
|
|
||||||
emission_sphere_radius = 1.0
|
|
||||||
flag_disable_z = true
|
|
||||||
spread = 180.0
|
|
||||||
gravity = Vector3( 0, 0, 0 )
|
|
||||||
initial_velocity = 50.0
|
|
||||||
orbit_velocity = 0.0
|
|
||||||
orbit_velocity_random = 0.0
|
|
||||||
color_ramp = SubResource( 3 )
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=5]
|
[sub_resource type="CircleShape2D" id=5]
|
||||||
radius = 50.0
|
radius = 50.0
|
||||||
|
|
||||||
|
@ -41,13 +24,7 @@ texture = ExtResource( 1 )
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="Particles2D" type="Particles2D" parent="."]
|
[node name="Particles2D" parent="." instance=ExtResource( 4 )]
|
||||||
emitting = false
|
|
||||||
amount = 200
|
|
||||||
one_shot = true
|
|
||||||
speed_scale = 2.5
|
|
||||||
explosiveness = 0.8
|
|
||||||
process_material = SubResource( 4 )
|
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
Loading…
Reference in a new issue