prepare for multiple players
This commit is contained in:
@@ -17,22 +17,30 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_follow(delta)
|
||||
var follow_position: Vector3 = Vector3.ZERO
|
||||
for player in Referencer.players:
|
||||
follow_position += _follow(player, delta)
|
||||
follow_position /= Referencer.players.size()
|
||||
|
||||
global_rotation_degrees = _angle_degrees
|
||||
global_position = (
|
||||
follow_position + Vector3.UP * _height_offset + transform.basis.z * _distance
|
||||
)
|
||||
|
||||
|
||||
func _follow(delta: float) -> void:
|
||||
var player_position := Referencer.player.global_position
|
||||
if Referencer.player.is_on_floor():
|
||||
func _follow(player: Player, delta: float) -> Vector3:
|
||||
var player_position := player.global_position
|
||||
if player.is_on_floor():
|
||||
_floor_height = player_position.y
|
||||
player_position.y = _floor_height + Projectile.HEIGHT
|
||||
|
||||
if Inputer.mode == Inputer.Mode.KB_MOUSE:
|
||||
_aim_offset = Referencer.player.aiming.aim_offset
|
||||
_aim_offset = player.aiming.aim_offset
|
||||
else:
|
||||
var new_aim_offset := (
|
||||
Vector3.ZERO
|
||||
if Referencer.player.aiming.aim_input.length() == 0
|
||||
else Referencer.player.aiming.aim_offset
|
||||
if player.aiming.aim_input.length() == 0
|
||||
else player.aiming.aim_offset
|
||||
)
|
||||
_aim_offset = _aim_offset.lerp(new_aim_offset, _aim_damping * delta)
|
||||
|
||||
@@ -48,9 +56,6 @@ func _follow(delta: float) -> void:
|
||||
)
|
||||
)
|
||||
|
||||
global_rotation_degrees = _angle_degrees
|
||||
global_position = (
|
||||
follow_position + Vector3.UP * _height_offset + transform.basis.z * _distance
|
||||
)
|
||||
Debugger.circle("follow_position" + str(player.index), follow_position)
|
||||
|
||||
Debugger.circle("follow_position", follow_position)
|
||||
return follow_position
|
||||
|
||||
Reference in New Issue
Block a user