This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scene_tree = get_parent().get_parent().get_parent().find_child("Player", true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var game_scene = get_parent().get_parent().get_parent() | |
var player_scene = get_parent().get_parent().get_parent().find_child("Player", true) | |
player_scene.global_position = player_spawn.global_position |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Input.is_action_pressed(&"accelerate"): | |
# Increase engine force at low speeds to make the initial acceleration faster. | |
var speed := linear_velocity.length() | |
if speed < 5.0 and not is_zero_approx(speed): | |
engine_force = clampf(engine_force_value * 5.0 / speed, 0.0, 100.0) | |
else: | |
engine_force = engine_force_value | |
# Apply analog throttle factor for more subtle acceleration if not fully holding down the trigger. | |
engine_force *= Input.get_action_strength(&"accelerate") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Input.is_action_pressed(&"reverse"): | |
print("Reverse pressed (fwd_mps: ", fwd_mps, ")") | |
# Increase engine force at low speeds to make the initial acceleration faster. | |
if fwd_mps >= -1.0: | |
var speed := linear_velocity.length() | |
print("Meters Per Second is gteq -1 (speed: ", speed, ")") | |
if speed < 5.0 and not is_zero_approx(speed): | |
print("Reverse Engine") | |
engine_force = -clampf(engine_force_value * 5.0 / speed, 0.0, 0.0) | |
brake = 0.0 |
OlderNewer