I went doing a bit of testing, and I would structure the scene this way:
- LeftBatArea (Area2D)
- CollisionShape (rectangle)
- LeftBat (KinematicBody2D + bat.gd)
- KeyboardInput (Node + bat_keyboard.gd)
- MouseInput (Node + bat_mouse.gd)
- TouchInput (Node + bat_touch.gd)
The bat.gd would only expose a
command variable that contains -1, 1 or 0 and moves according to that parameter.
Then, every input node would reference the parent, and set the command for each possible input.
Mouse and touch might want to handle the
input_event signal from
LeftBatArea so they know when an event happened over the control area of the bat.
One thing to note, you should store the touch index so you know which finger controls the bat, in case your game can be played with multiple users on a touchscreen (doing that with the mouse is impossible because there can be only one mouse).
Another thing is, Godot emulates mouse event on touch devices, so you should test if the mouse input node enters in conflict with the touch input node or not.