Use some map options
This commit is contained in:
parent
9d5dbadc64
commit
92726a3290
|
@ -4,10 +4,10 @@ extends CharacterBody2D
|
||||||
const ROTATION = 0.05
|
const ROTATION = 0.05
|
||||||
|
|
||||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
# 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 Bullet = preload("res://World/bullet.tscn")
|
||||||
|
|
||||||
var thrust = 6.0
|
var thrust = 6.0
|
||||||
|
var gravity := Vector2.ZERO
|
||||||
|
|
||||||
# Set by the authority, synchronized on spawn.
|
# Set by the authority, synchronized on spawn.
|
||||||
@export var player := 1 :
|
@export var player := 1 :
|
||||||
|
@ -27,7 +27,8 @@ func _ready():
|
||||||
# Only process on server.
|
# Only process on server.
|
||||||
# EDIT: Left the client simulate player movement too to compesate network latency.
|
# EDIT: Left the client simulate player movement too to compesate network latency.
|
||||||
# set_physics_process(multiplayer.is_server())
|
# set_physics_process(multiplayer.is_server())
|
||||||
pass
|
|
||||||
|
gravity = 1000*$"../../Map/Options".gravity * Vector2.LEFT.rotated(deg_to_rad($"../../Map/Options".gravityangle))
|
||||||
|
|
||||||
func shoot():
|
func shoot():
|
||||||
# "Muzzle" is a Marker2D placed at the barrel of the gun.
|
# "Muzzle" is a Marker2D placed at the barrel of the gun.
|
||||||
|
@ -39,7 +40,7 @@ func _physics_process(delta):
|
||||||
rotation += input.rotate
|
rotation += input.rotate
|
||||||
|
|
||||||
# Add the gravity.
|
# Add the gravity.
|
||||||
velocity.y += gravity * delta
|
velocity += gravity * delta
|
||||||
|
|
||||||
if input.thrust:
|
if input.thrust:
|
||||||
velocity += Vector2(thrust, 0).rotated(rotation)
|
velocity += Vector2(thrust, 0).rotated(rotation)
|
||||||
|
|
Loading…
Reference in New Issue