Added projectiles timeouts. Added GatlingWeapon animation
This commit is contained in:
@@ -18,6 +18,8 @@ const OFF_TIMES = [
|
||||
]
|
||||
const ON_TIME = 0.05
|
||||
|
||||
const SCROLL_VELOCITY = Vector2(-50, 0)
|
||||
|
||||
|
||||
enum SpriteState {
|
||||
ON,
|
||||
@@ -43,15 +45,11 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
func _process_acceleration(delta: float) -> void:
|
||||
var current_deceleration := deceleration * delta
|
||||
if _velocity.length() > current_deceleration:
|
||||
_velocity -= _velocity.normalized() * current_deceleration
|
||||
else:
|
||||
_velocity = Vector2.ZERO
|
||||
|
||||
|
||||
func _on_livetime_timer_timeout() -> void:
|
||||
queue_free()
|
||||
var delta_velocity := SCROLL_VELOCITY - _velocity
|
||||
var new_direction := delta_velocity.normalized()
|
||||
var current_deceleration := clampf(delta_velocity.length(), 0.0, deceleration * delta)
|
||||
|
||||
_velocity += new_direction * current_deceleration
|
||||
|
||||
|
||||
func _on_blast_body_entered(body: Node2D) -> void:
|
||||
|
||||
@@ -59,24 +59,21 @@ collision_mask = 0
|
||||
damage = SubResource("Resource_ckqco")
|
||||
shape = SubResource("CircleShape2D_px1i2")
|
||||
|
||||
[node name="LivetimeTimer" type="Timer" parent="." index="5"]
|
||||
wait_time = 60.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="SpriteOnTimer" type="Timer" parent="." index="6"]
|
||||
[node name="SpriteOnTimer" type="Timer" parent="." index="5"]
|
||||
one_shot = true
|
||||
|
||||
[node name="SpriteOffTimer" type="Timer" parent="." index="7"]
|
||||
[node name="SpriteOffTimer" type="Timer" parent="." index="6"]
|
||||
one_shot = true
|
||||
|
||||
[node name="ExplosionParticles" parent="." index="8" instance=ExtResource("5_ckqco")]
|
||||
[node name="ExplosionParticles" parent="." index="7" instance=ExtResource("5_ckqco")]
|
||||
process_material = SubResource("ParticleProcessMaterial_ckqco")
|
||||
amount_ratio = 0.5
|
||||
|
||||
[node name="OutOfScreenTimer" parent="." index="8"]
|
||||
wait_time = 5.0
|
||||
|
||||
[connection signal="body_entered" from="Blast" to="." method="_on_blast_body_entered"]
|
||||
[connection signal="body_exited" from="Blast" to="." method="_on_blast_body_exited"]
|
||||
[connection signal="timeout" from="LivetimeTimer" to="." method="_on_livetime_timer_timeout"]
|
||||
[connection signal="timeout" from="SpriteOnTimer" to="." method="_on_sprite_on_timer_timeout"]
|
||||
[connection signal="timeout" from="SpriteOffTimer" to="." method="_on_sprite_off_timer_timeout"]
|
||||
[connection signal="finished" from="ExplosionParticles" to="." method="_on_explosion_particles_finished"]
|
||||
|
||||
Reference in New Issue
Block a user