diff --git a/constants.py b/constants.py index f12995317781ea30cefb4823765a4b97f5a26ac8..6b66ec3074a6c619446a30322d31aa4d67c3ff97 100644 --- a/constants.py +++ b/constants.py @@ -7,8 +7,8 @@ A file to store constants in GRAVITY = Vector2(0, 666) # Gravity applied to all objects -COLLISION_FRICTION = 0.1 # Friction applied when the object is colliding -AIR_FRICTION = 0.01 # Friction applied when the object is in the air +COLLISION_FRICTION = 0.13 # Friction applied when the object is colliding +AIR_FRICTION = 0.012 # Friction applied when the object is in the air PADDLE_SPEED = 666 # degrees per second PADDLE_COLLISION_DAMPING = .66 # Factor to scale the velocity with when the paddle is hit diff --git a/data/data.png b/data/data.png index 9f08a344ff5c655ae81537a8eb7fdb046ed14b36..4a40797ad837a757363f16ac3dd28b0f5e82d32c 100644 Binary files a/data/data.png and b/data/data.png differ diff --git a/data/options.json b/data/options.json index 4daf3514d045a01b50abb1d7ed620290196dabab..3d68da4eb3137b6f8a7e0edf078c036b26c6a36d 100644 --- a/data/options.json +++ b/data/options.json @@ -1 +1 @@ -{"asf": 1.0, "master_volume": 50, "music_volume": 21, "sfx_volume": 58, "user_name": "Player"} \ No newline at end of file +{"asf": 2.0, "master_volume": 50, "music_volume": 21, "sfx_volume": 58, "user_name": "Player"} \ No newline at end of file diff --git a/source/api/components/rigidbody.py b/source/api/components/rigidbody.py index f13a5d581f58ea7f6dedf7d8bbcdf81ea1d49de0..75cc1bb7a5312e21305c7fde764853c769a37902 100644 --- a/source/api/components/rigidbody.py +++ b/source/api/components/rigidbody.py @@ -117,7 +117,7 @@ class Rigidbody(Component): self.acceleration += GRAVITY * self.asf self.velocity += (self.acceleration * scaled_delta_time) - self.velocity *= (1 - (AIR_FRICTION/PTPF)/self.asf) + self.velocity *= (1 - (AIR_FRICTION/PTPF)/max(self.asf, 1)) self.parent.transform.pos += (self.velocity * scaled_delta_time) @@ -188,14 +188,14 @@ class Rigidbody(Component): angle_of_impact = abs(normal.dot(self.velocity.normalize())) # Calculate the velocity magnitude velocity_magnitude = self.velocity.length() - # Adjust the friction based on the velocity and the angle of impact + # Adjust the friction based on the velocity and the angle of impact adjusted_friction = other_collider.friction * (clamp(velocity_magnitude / (500*self.asf), .2, 1)) * (1 + angle_of_impact/10) reflected_velocity *= clamp(1 - adjusted_friction, 0.5, 1) # If the other object has a rotation speed, calculate the angular momentum if other_collider.parent.transform.do_smooth_rotation: # Calculate the angular velocity vector - angular_velocity = normal * (other_collider.parent.transform.rotation_speed*max(self.asf, 1))/(PADDLE_COLLISION_DAMPING * self.asf) + angular_velocity = normal * ((other_collider.parent.transform.rotation_speed*self.asf)/PADDLE_COLLISION_DAMPING) * (self.asf**(1/2)) # Add the angular momentum to the velocity of the ball self.velocity = reflected_velocity + angular_velocity diff --git a/source/game/scenes/main_pinball.py b/source/game/scenes/main_pinball.py index a76e0bd0a7be5e3cf76e6e80617210123f4f4323..0d33567e8adc85edac8660124fb693b9829f63c4 100644 --- a/source/game/scenes/main_pinball.py +++ b/source/game/scenes/main_pinball.py @@ -114,7 +114,7 @@ class MainPinball(Scene): scale_strength = .25 self.add_gameobject(Plunger(self, V2(width - self.ball_radius*3, height), - V2(width, height), impuls_range=(int(1300*(asf**1.3)), int(1400*(asf**1.3))))) + V2(width, height), impuls_range=(int(1400*asf), int(1600*asf)))) self.left_flipper = Flipper(self, V2(300*asf - 130 * asf, height - 125*asf), 30) self.right_flipper = Flipper(self, V2(300*asf + 130 * asf, height - 125*asf), 150)