-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Controller Input #110
Add Controller Input #110
Conversation
Thanks for your pull request! |
if Input.is_action_pressed("ui_up"): | ||
if Input.is_action_pressed("acc+"): | ||
soll_command += 0.7 * delta | ||
if Input.is_action_pressed("ui_down"): | ||
if Input.is_action_pressed("acc-"): | ||
soll_command -= 0.7 * delta | ||
if soll_command >= 1: | ||
soll_command = 1 | ||
if soll_command <= -1: | ||
soll_command = -1 | ||
if Input.is_action_pressed("ui_left"): | ||
if Input.is_action_pressed("brake-"): | ||
soll_command = 0 | ||
if Input.is_action_pressed("ui_right"): | ||
if Input.is_action_pressed("brake+"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that one?
The behaviour is the same
Just drive the tutorial track on this branch with Easy Mode and arrow keys... WASD Steering is also different to the version of master branch... |
I fixed the arrow key steering. Maybe I am blind, but how is WASD steering different? Are the acceleration or break axis inversed? |
Co-Authored-By: Jean28518 <jf_v@gmx.de>
5735c24
to
c01ffa4
Compare
Your last commit removed WASD controls completly. Was that planned? |
Yes, that was planned :) |
I also did some refactoring. For example, you can shorten
TranslationServer.translate()
totr()
, use_unhandled_input_event
instead of_process
to process input actions, and use GDScript format strings, to build strings.THe change itself:
I added bindings for controllers (the easy part) and a new class called InputLabel that changes the input based on the device and supplied action. In order to insert any control into the translations they need to use format strings as well. Luckily
%s
converts anything that can be casted to a string (which is everything).The detection of the used controller is incomplete, so everytime somebody reports a new GUID, it has to be added or we go and grab a SDL controller DB dumb an integrate that or we add a Godot Method with the most common gamepad types.
Lastly we should implement input settings. It should be relativly easy now, but I wanted to finish this PR to get into bed and back to my primary work. Please review carefully, as I had to a rebase way to late in the night.
Fixes #105