mirror of
https://github.com/Nokorpo/LibreAim.git
synced 2025-06-10 18:10:50 +09:00
Add player_movement to gamemode settings
This commit is contained in:
parent
b53cdbe797
commit
ea7bf2dd45
6 changed files with 17 additions and 11 deletions
|
@ -5,6 +5,7 @@ description = "All targets spawn at the same height."
|
|||
|
||||
[settings]
|
||||
time = 30
|
||||
player_movement = true
|
||||
|
||||
[target]
|
||||
spawn_location = {
|
||||
|
|
|
@ -5,6 +5,7 @@ description = "Targets move in random patterns."
|
|||
|
||||
[settings]
|
||||
time = 30
|
||||
player_movement = true
|
||||
|
||||
[target]
|
||||
spawn_location = {
|
||||
|
|
|
@ -5,6 +5,7 @@ description = "Random static targets."
|
|||
|
||||
[settings]
|
||||
time = 30
|
||||
player_movement = true
|
||||
|
||||
[target]
|
||||
spawn_location = {
|
||||
|
|
|
@ -5,6 +5,7 @@ description = "Keep your aim tracking a target."
|
|||
|
||||
[settings]
|
||||
time = 30
|
||||
player_movement = false
|
||||
|
||||
[target]
|
||||
spawn_location = {
|
||||
|
|
|
@ -26,6 +26,7 @@ func load_gamemodes():
|
|||
this_gamemode.title = config.get_value("metadata", "title")
|
||||
this_gamemode.description = config.get_value("metadata", "description")
|
||||
this_gamemode.time = config.get_value("settings", "time")
|
||||
this_gamemode.player_movement = config.get_value("settings", "player_movement")
|
||||
this_gamemode.movement = config.get_value("target", "movement")
|
||||
this_gamemode.health = config.get_value("target", "health")
|
||||
this_gamemode.size = config.get_value("target", "size")
|
||||
|
|
|
@ -32,7 +32,7 @@ func _input(event) -> void:
|
|||
if Global.current_gamemode.health == 0:
|
||||
if event.is_action_pressed("shoot"):
|
||||
shoot(1)
|
||||
if event.is_action_pressed("jump"):
|
||||
if event.is_action_pressed("jump") and Global.current_gamemode.player_movement:
|
||||
jump()
|
||||
|
||||
var elapsed: float
|
||||
|
@ -46,16 +46,17 @@ func _process(delta):
|
|||
elapsed = 0
|
||||
|
||||
func _physics_process(delta) -> void:
|
||||
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).normalized() * SPEED
|
||||
movement_velocity = transform.basis * movement_velocity
|
||||
|
||||
var applied_velocity := velocity.lerp(movement_velocity, delta * 10)
|
||||
applied_velocity.y = -gravity
|
||||
|
||||
velocity = applied_velocity
|
||||
move_and_slide()
|
||||
if Global.current_gamemode.player_movement:
|
||||
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).normalized() * SPEED
|
||||
movement_velocity = transform.basis * movement_velocity
|
||||
|
||||
var applied_velocity := velocity.lerp(movement_velocity, delta * 10)
|
||||
applied_velocity.y = -gravity
|
||||
|
||||
velocity = applied_velocity
|
||||
move_and_slide()
|
||||
|
||||
func handle_gravity(delta):
|
||||
gravity += 20 * delta
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue