Made kamikaze behavior and also fixed borders

This commit is contained in:
2ndbeam 2024-05-05 18:20:34 +03:00
commit 1ee0b529a8
10 changed files with 41 additions and 44 deletions

View file

@ -52,9 +52,12 @@ func _physics_process(_delta):
ship.rotation = rotation
scalar_velocity = linear_velocity.length()
func _on_body_entered(_body):
func _on_body_entered(body):
if scalar_velocity >= velocity_collision_treshold:
ship.shield.deal_damage(20.0 * (scalar_velocity / velocity_collision_treshold))
var damage = collision_damage * (scalar_velocity / velocity_collision_treshold)
ship.shield.deal_damage(damage)
if body is Ship:
body.shield.deal_damage(damage / 2)
func warp_to_position(location: Vector2):
position = location