Crafty icon indicating copy to clipboard operation
Crafty copied to clipboard

Break out joypad like input into a new component

Open starwed opened this issue 8 years ago • 3 comments

A lot of the logic in Multiway has nothing to do with movement, and everything to do with handling the input. You might want a joypad-like input for a lot of different effects (i.e. a dual stick type input such as Binding of Isaac, or a component that sets acceleration instead of velocity) so it would be nice to have that in an isolated component.

My idea would be to have a "Joypad" component trigger events with an object representing the direction of input (a pair of x and y values which represent an input vector). Then Multiway could just listen for those directional events and update the velocity accordingly. The joypad component/system would let you specify how you wanted multiple inputs combined: simply summed as now, normalized/clamped as suggested by #1047 , or restricted to one direction at a time as suggested by #1046.

Something like this would really help folk who are trying to tack specialized movement patterns on top of Multiway/etc.

starwed avatar Sep 05 '16 20:09 starwed

Would this also mean to embed https://github.com/svenjacobs/crafty-gamepad as well?

matthijsgroen avatar Sep 05 '16 20:09 matthijsgroen

Would this also mean to embed https://github.com/svenjacobs/crafty-gamepad as well?

Well, this would provide an abstraction that should make alternate inputs much easier to wire up. (I mostly talk about d-pads above, but we'd probably want to do something similar for simple buttons.)

starwed avatar Sep 06 '16 22:09 starwed

Update:

  • [x] Completed directional input (aka multiway) in #1051
  • [x] Completed for button triggers (like twoway's jump button) in #1057
  • [ ] Map pointer input (mouse & touch) to control events
    • Drag & Drop control events (aka Draggable, Viewport.mouselook)
    • Generic pointer events?
  • [ ] Mapping joypad, gamepad or touchscreen input to other types. (Related to #987)

starwed avatar Dec 24 '16 00:12 starwed