mirror of https://github.com/profan/ld-39-jam.git
missile testing, also let missiles be hit by bullets, its neat
This commit is contained in:
parent
ed53d1b190
commit
0c586d9b41
|
@ -19,6 +19,9 @@ func fire(delta, vel, dir, speed):
|
||||||
func type():
|
func type():
|
||||||
return "Bullet"
|
return "Bullet"
|
||||||
|
|
||||||
|
func do_damage(v):
|
||||||
|
lifetime = 0
|
||||||
|
|
||||||
func on_impact(e):
|
func on_impact(e):
|
||||||
|
|
||||||
# create bullet impact
|
# create bullet impact
|
||||||
|
|
|
@ -15,7 +15,7 @@ input/pickable = false
|
||||||
shapes/0/shape = SubResource( 1 )
|
shapes/0/shape = SubResource( 1 )
|
||||||
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
|
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
|
||||||
shapes/0/trigger = false
|
shapes/0/trigger = false
|
||||||
collision/layers = 2
|
collision/layers = 0
|
||||||
collision/mask = 2
|
collision/mask = 2
|
||||||
collision/margin = 0.08
|
collision/margin = 0.08
|
||||||
script/script = ExtResource( 1 )
|
script/script = ExtResource( 1 )
|
||||||
|
|
40
Game.tscn
40
Game.tscn
|
@ -25,7 +25,7 @@ transform/pos = Vector2( 119.085, -182.303 )
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 5 )]
|
[node name="Player" parent="." instance=ExtResource( 5 )]
|
||||||
|
|
||||||
transform/pos = Vector2( 92.7742, 71.7896 )
|
transform/pos = Vector2( 92.7742, 1023.01 )
|
||||||
|
|
||||||
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
|
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
|
||||||
|
|
||||||
|
@ -74,4 +74,42 @@ transform/scale = Vector2( 1.5, 1.5 )
|
||||||
|
|
||||||
[node name="Missile" parent="." instance=ExtResource( 8 )]
|
[node name="Missile" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( -494.716, 83.0652 )
|
||||||
|
|
||||||
|
[node name="Missile2" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( -298.447, 258.752 )
|
||||||
|
|
||||||
|
[node name="Missile3" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 23.9903, 342.962 )
|
||||||
|
|
||||||
|
[node name="Missile4" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 337.516, 416.822 )
|
||||||
|
|
||||||
|
[node name="Missile5" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 744.497, 386.675 )
|
||||||
|
|
||||||
|
[node name="Missile6" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 972.105, 74.6563 )
|
||||||
|
|
||||||
|
[node name="Missile7" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 920.856, -183.098 )
|
||||||
|
|
||||||
|
[node name="Missile8" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 735.453, -300.671 )
|
||||||
|
|
||||||
|
[node name="Missile9" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 346.56, -311.222 )
|
||||||
|
|
||||||
|
[node name="Missile1" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
transform/pos = Vector2( -380.718, -157.427 )
|
||||||
|
|
||||||
|
|
||||||
|
|
12
Missile.gd
12
Missile.gd
|
@ -27,7 +27,7 @@ func _ready():
|
||||||
s_seek.set_target(player)
|
s_seek.set_target(player)
|
||||||
s_arrive.set_target(player)
|
s_arrive.set_target(player)
|
||||||
|
|
||||||
func on_impact(e):
|
func on_impact(e, is_bullet):
|
||||||
|
|
||||||
# create bullet impact
|
# create bullet impact
|
||||||
var new_mi = MissileImpact.instance()
|
var new_mi = MissileImpact.instance()
|
||||||
|
@ -37,8 +37,12 @@ func on_impact(e):
|
||||||
new_mi.set_scale(Vector2(1.5, 1.5)) # when missile, larger effect
|
new_mi.set_scale(Vector2(1.5, 1.5)) # when missile, larger effect
|
||||||
new_mi.set_global_pos(get_collision_pos())
|
new_mi.set_global_pos(get_collision_pos())
|
||||||
|
|
||||||
|
if not is_bullet:
|
||||||
# align along "hit normal, the lazy way"
|
# align along "hit normal, the lazy way"
|
||||||
new_mi.set_global_rot((-get_collision_normal()).angle())
|
new_mi.set_global_rot((-get_collision_normal()).angle())
|
||||||
|
else:
|
||||||
|
new_mi.set_global_rot(get_global_rot())
|
||||||
|
new_mi.rotate(deg2rad(180))
|
||||||
|
|
||||||
# new_bi.rotate(deg2rad(180))
|
# new_bi.rotate(deg2rad(180))
|
||||||
|
|
||||||
|
@ -53,7 +57,11 @@ func _fixed_process(delta):
|
||||||
|
|
||||||
if is_colliding():
|
if is_colliding():
|
||||||
var e = get_collider()
|
var e = get_collider()
|
||||||
on_impact(e)
|
var e_t = e.type()
|
||||||
|
if e_t == "Bullet":
|
||||||
|
on_impact(e, true)
|
||||||
|
elif e_t != "Missile":
|
||||||
|
on_impact(e, false)
|
||||||
|
|
||||||
func type():
|
func type():
|
||||||
return "Missile"
|
return "Missile"
|
||||||
|
|
|
@ -10,7 +10,7 @@ var done = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
set_process(true)
|
set_process(true)
|
||||||
total_time = sprite.get_hframes() * frames_per_second + 1.5 # 4 extra seconds for particle blast
|
total_time = sprite.get_hframes() * frames_per_second + 0.75 # 4 extra seconds for particle blast
|
||||||
ps.set_process(false)
|
ps.set_process(false)
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
|
|
@ -17,8 +17,8 @@ hframes = 5
|
||||||
|
|
||||||
transform/pos = Vector2( 0.130829, -3.26887 )
|
transform/pos = Vector2( 0.130829, -3.26887 )
|
||||||
transform/rot = -180.0
|
transform/rot = -180.0
|
||||||
config/amount = 32
|
config/amount = 8
|
||||||
config/lifetime = 4.0
|
config/lifetime = 2.0
|
||||||
config/time_scale = 2.0
|
config/time_scale = 2.0
|
||||||
config/process_mode = 1
|
config/process_mode = 1
|
||||||
config/explosiveness = 0.1
|
config/explosiveness = 0.1
|
||||||
|
|
Loading…
Reference in New Issue