Prevent multiple gear switches on single action with manual transmission
parent
35da3be64c
commit
8a41653dbb
|
@ -6,8 +6,7 @@ export(NodePath) var vehicle_path = null
|
|||
onready var _vehicle: BuggedVehicle = get_node(vehicle_path)
|
||||
|
||||
|
||||
func _input(_event: InputEvent) -> void:
|
||||
# Using _input just to make sure events are captured right away
|
||||
func _physics_process(_delta: float) -> void:
|
||||
_vehicle.inputs.throttle = Input.get_action_strength("throttle")
|
||||
_vehicle.inputs.clutch = Input.get_action_strength("clutch")
|
||||
_vehicle.inputs.brake = Input.get_action_strength("brake")
|
||||
|
@ -22,7 +21,7 @@ func _input(_event: InputEvent) -> void:
|
|||
_vehicle.inputs.steering = steering_input
|
||||
if Input.is_action_just_pressed("gear_up"):
|
||||
_vehicle.inputs.gear_request = BuggedVehicle.GearRequest.UP
|
||||
elif Input.is_action_pressed("gear_down"):
|
||||
elif Input.is_action_just_pressed("gear_down"):
|
||||
_vehicle.inputs.gear_request = BuggedVehicle.GearRequest.DOWN
|
||||
else:
|
||||
_vehicle.inputs.gear_request = BuggedVehicle.GearRequest.NONE
|
||||
|
|
Loading…
Reference in New Issue