diff --git a/World/PlayerShip.gd b/World/PlayerShip.gd index 88c32b7..9360ac7 100644 --- a/World/PlayerShip.gd +++ b/World/PlayerShip.gd @@ -4,10 +4,10 @@ extends CharacterBody2D const ROTATION = 0.05 # Get the gravity from the project settings to be synced with RigidBody nodes. -var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") var Bullet = preload("res://World/bullet.tscn") var thrust = 6.0 +var gravity := Vector2.ZERO # Set by the authority, synchronized on spawn. @export var player := 1 : @@ -27,7 +27,8 @@ func _ready(): # Only process on server. # EDIT: Left the client simulate player movement too to compesate network latency. # set_physics_process(multiplayer.is_server()) - pass + + gravity = 1000*$"../../Map/Options".gravity * Vector2.LEFT.rotated(deg_to_rad($"../../Map/Options".gravityangle)) func shoot(): # "Muzzle" is a Marker2D placed at the barrel of the gun. @@ -39,7 +40,7 @@ func _physics_process(delta): rotation += input.rotate # Add the gravity. - velocity.y += gravity * delta + velocity += gravity * delta if input.thrust: velocity += Vector2(thrust, 0).rotated(rotation)