mirror of
https://github.com/Nokorpo/LibreAim.git
synced 2025-06-09 09:35:16 +09:00
Allow playing game_world without gamemode selected
This commit is contained in:
parent
5622ff6c2a
commit
a8a16dfdb8
2 changed files with 9 additions and 8 deletions
|
@ -7,10 +7,11 @@ var count_kills := 0
|
|||
@onready var gameplay_ui = $CanvasLayer/GameplayUI
|
||||
|
||||
func _ready() -> void:
|
||||
timer.wait_time = Global.current_gamemode.time
|
||||
|
||||
for target: int in range(Global.current_gamemode.initial_targets):
|
||||
spawn_target()
|
||||
if Global.current_gamemode:
|
||||
timer.wait_time = Global.current_gamemode.time
|
||||
|
||||
for target: int in range(Global.current_gamemode.initial_targets):
|
||||
spawn_target()
|
||||
update_world_environment()
|
||||
|
||||
func _process(_delta) -> void:
|
||||
|
|
|
@ -30,16 +30,16 @@ func _input(event) -> void:
|
|||
rotate_y(deg_to_rad(-event.relative.x * mouse_sensitivity))
|
||||
camera.rotate_x(deg_to_rad(-event.relative.y * mouse_sensitivity))
|
||||
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-MAX_CAMERA_ANGLE), deg_to_rad(MAX_CAMERA_ANGLE))
|
||||
if Global.current_gamemode.health == 0:
|
||||
if Global.current_gamemode and Global.current_gamemode.health == 0:
|
||||
if event.is_action_pressed("shoot"):
|
||||
shoot(1)
|
||||
if event.is_action_pressed("jump") and Global.current_gamemode.player_movement:
|
||||
if event.is_action_pressed("jump") and ((Global.current_gamemode and Global.current_gamemode.player_movement) or Global.current_gamemode.is_empty()):
|
||||
jump()
|
||||
|
||||
var elapsed: float
|
||||
func _process(delta):
|
||||
const COOLDOWN = .2
|
||||
if Global.current_gamemode.health > 0:
|
||||
if Global.current_gamemode and Global.current_gamemode.health > 0:
|
||||
elapsed += delta
|
||||
if elapsed > COOLDOWN:
|
||||
if Input.is_action_pressed("shoot"):
|
||||
|
@ -49,7 +49,7 @@ func _process(delta):
|
|||
handle_joypad_rotation(delta)
|
||||
|
||||
func _physics_process(delta) -> void:
|
||||
if Global.current_gamemode.player_movement:
|
||||
if (Global.current_gamemode and Global.current_gamemode.player_movement) or Global.current_gamemode.is_empty():
|
||||
handle_gravity(delta)
|
||||
var input := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
var movement_velocity := Vector3(input.x, 0, input.y) * SPEED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue