diff --git a/src/equipment/balls/physics_ball/game_ball.gd b/src/equipment/balls/physics_ball/game_ball.gd index e639c8f..5fc9bb4 100644 --- a/src/equipment/balls/physics_ball/game_ball.gd +++ b/src/equipment/balls/physics_ball/game_ball.gd @@ -44,6 +44,9 @@ const IRON_DAMPING := 9999.0 ## Base damage inflicted on impact with a player @export var base_damage := 15.0 +## Scaling factor for additional force-based damage +@export var damage_force_scale := 0.01 + var _last_contact_normal: Vector3 = Vector3.UP var _position_on_last_wake: Vector3 var _awake := false @@ -64,6 +67,11 @@ func enter_water() -> void: entered_water.emit() +func get_damage() -> float: + print("velocity: ", linear_velocity.length()) + return base_damage + linear_velocity.length_squared() * damage_force_scale + + func _total_terrain_angular_damping() -> float: return _zones.reduce( func(a: float, b: BallZone) -> float: return a + b.terrain_angular_damping, 0.0 diff --git a/src/equipment/balls/plasma_ball/plasma_ball.tscn b/src/equipment/balls/plasma_ball/plasma_ball.tscn index a0ae8de..03ac039 100644 --- a/src/equipment/balls/plasma_ball/plasma_ball.tscn +++ b/src/equipment/balls/plasma_ball/plasma_ball.tscn @@ -49,6 +49,7 @@ size = Vector2(0.4, 0.4) [node name="PlasmaBall" instance=ExtResource("1_yh4fp")] script = ExtResource("2_pdts3") +base_damage = 30.0 [node name="PlasmaFireEffect" type="GPUParticles3D" parent="BallMesh" index="0"] amount = 20 diff --git a/src/player/shot_setup/shot_setup.gd b/src/player/shot_setup/shot_setup.gd index d69be04..14a5de0 100644 --- a/src/player/shot_setup/shot_setup.gd +++ b/src/player/shot_setup/shot_setup.gd @@ -583,9 +583,10 @@ func _on_ball_return_timer_timeout() -> void: func _on_hitbox_ball_collision(ball: GameBall) -> void: # TODO play animation - player.life -= ball.base_damage + var damage := ball.get_damage() + player.life -= damage game.viewport.hit_lag_big() - game.viewport.screen_shake(ball.base_damage, 0.4) + game.viewport.screen_shake(damage, 0.4) explosion_animation.play("explode") # TODO kinematic collisions