mapping input controls to key

About Monkey 2 Forums Monkey 2 Programming Help mapping input controls to key

This topic contains 4 replies, has 3 voices, and was last updated by  wiebow 3 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1152

    wiebow
    Participant

    I am trying to set up a system where I can map controls to keys. For instance, UP maps to the key A. This is the code:

    The only thing I get back are zeros.  Am I missing something here? Thanks!

    #1156

    peterigz
    Participant

    Try adding

    New AppInstance

    At the start of main, I think that initialises a load of stuff in mojo so it’s ready for use.

    #1157

    wiebow
    Participant

    geez Pete, that is it… Thanks so very much. Valuable lesson!

    #1167

    Ethernaut
    Participant

    Although it’s one of those things you don’t forget once you learn it, I feel like it would be a more intuitive/familiar design if instead of using “New AppInstance”, the command was “Mojo.Init()” or “App.Init()” or something like that.

    It would be cool if the App.Run() ran automatically somehow as well. Monkey 1’s simplicity of use is a good design target for me.

    Actually, I wonder why Mark didn’t create an App class that handles the Window and all the initialization like it does in M1. The new way offers a lot of control, but is also more complex and has more room for error. I feel that it could be an option alongside a simpler M1 style App class as the main option. Maybe it’s planned for the future?

    #1169

    wiebow
    Participant

    I also found out that App.Run() is also needed to get proper readings for the Keyboard Down and Hit methods. So it is not just the initialization that is required… Something to take away when creating testbeds.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.