{"author_link":"\/users\/ex3d0","author_name":"EX3D0","author_uid":"ex3d0","comments":[],"epoch":1502391364,"event":"LD39","format":"md","ldjam_node_id":48695,"likes":0,"metadata":{"p_key":"100657","p_author":"EX3D0","p_authorkey":"1011301","p_urlkey":"316367","p_title":"The Joys of Alternate Control Methods","p_cat":"LDJam ","p_event":"LD39","p_time":"1502391364","p_likes":"0","p_comments":"0","p_status":"WAYBACK","us_key":"1011301","us_name":"EX3D0","us_username":"ex3d0","event_start":"1501200000","event_key":"74","event_name":"LD 39"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD39","removed_author":false},"_superparent":32802,"_trust":4,"author":11301,"body":"*This is a repost from the devblog [here](https:\/\/rechargedgame.wordpress.com\/2017\/08\/10\/the-joys-of-alternate-control-methods\/)*\n\nCurrently Recharged\u2019s only control scheme was with a keyboard. While this was fine at first, the game\u2019s needs have evolved since then.\n\nFirstly, having just keyboard input meant porting to mobile (Android and iOS) would be impossible. Someone playing on a phone can\u2019t use a keyboard to play. Enter the on-screen controller. Right now it\u2019s a simple quad-directional d-pad but it get\u2019s the job done. Here\u2019s what it currently looks like (Looks will definitely change in final versions)\n\n![357cf29e8e7f4c761288fff797dac5d9.png](\/\/\/raw\/52c\/2\/z\/8d53.png)\n\n(Ignore the debug lines around the player and batteries)\n\nThe on-screen controller wasn\u2019t too hard to implement, it just checks if any of the buttons have been hit and moves the player accordingly. With this it means that porting the game to mobile is just about complete.\n\nI also wanted to give the game support for controllers. It wasn\u2019t necessarily needed but it was just something I wanted to add.\n\nAdding support proved a bit harder than expected, seeing as I\u2019ve never used LibGDX\u2019s Controller library before. Unfortunately LibGDX doesn\u2019t support the Xbox controller (the first controller I\u2019ve added support for) out of the box, luckily the internet came to the rescue. I was able to come across [this thread](http:\/\/www.java-gaming.org\/topics\/libgdx-xbox360-controller-mapping\/29223\/view.html) which contained the Xbox 360 controller mappings (The Xbox One and 360 controllers have the same mappings on PC). Adding those into a class allowed me the ability to easily access any of the controller\u2019s buttons. After that it was a simple matter of polling which button (or analog stick) was hit and perform the appropriate action.\n\nAs of now the game now has keyboard\/mouse, controller, and touchscreen controls. Right now the only supported controllers are the Xbox 360 controller and Xbox One controller (as I mentioned before they have the same key mappings). I\u2019m hoping to add Playstation controller support if I can get my hands on one.","comments":0,"created":"2017-08-10T18:54:02Z","files":[],"files-timestamp":0,"id":48695,"love":0,"meta":[],"modified":"2017-08-10T18:56:04Z","name":"The Joys of Alternate Control Methods","node-timestamp":"2017-08-10T18:56:04Z","parent":39046,"parents":[1,5,9,32802,39046],"path":"\/events\/ludum-dare\/39\/recharged\/the-joys-of-alternate-control-methods","published":"2017-08-10T18:56:04Z","scope":"public","slug":"the-joys-of-alternate-control-methods","subsubtype":"","subtype":"","type":"post","version":139064},"node_metadata":{"n_key":"48695","n_urlkey":"316367","n_parent":"39046","n_path":"\/events\/ludum-dare\/39\/recharged\/the-joys-of-alternate-control-methods","n_slug":"the-joys-of-alternate-control-me","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"11301","n_created":"1502391242","n_modified":"1502391364","n_version":"139064","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/39\/recharged\/the-joys-of-alternate-control-methods","text":"*This is a repost from the devblog [here](https:\/\/rechargedgame.wordpress.com\/2017\/08\/10\/the-joys-of-alternate-control-methods\/)*\n\nCurrently Recharged\u2019s only control scheme was with a keyboard. While this was fine at first, the game\u2019s needs have evolved since then.\n\nFirstly, having just keyboard input meant porting to mobile (Android and iOS) would be impossible. Someone playing on a phone can\u2019t use a keyboard to play. Enter the on-screen controller. Right now it\u2019s a simple quad-directional d-pad but it get\u2019s the job done. Here\u2019s what it currently looks like (Looks will definitely change in final versions)\n\n![357cf29e8e7f4c761288fff797dac5d9.png](\/\/\/raw\/52c\/2\/z\/8d53.png)\n\n(Ignore the debug lines around the player and batteries)\n\nThe on-screen controller wasn\u2019t too hard to implement, it just checks if any of the buttons have been hit and moves the player accordingly. With this it means that porting the game to mobile is just about complete.\n\nI also wanted to give the game support for controllers. It wasn\u2019t necessarily needed but it was just something I wanted to add.\n\nAdding support proved a bit harder than expected, seeing as I\u2019ve never used LibGDX\u2019s Controller library before. Unfortunately LibGDX doesn\u2019t support the Xbox controller (the first controller I\u2019ve added support for) out of the box, luckily the internet came to the rescue. I was able to come across [this thread](http:\/\/www.java-gaming.org\/topics\/libgdx-xbox360-controller-mapping\/29223\/view.html) which contained the Xbox 360 controller mappings (The Xbox One and 360 controllers have the same mappings on PC). Adding those into a class allowed me the ability to easily access any of the controller\u2019s buttons. After that it was a simple matter of polling which button (or analog stick) was hit and perform the appropriate action.\n\nAs of now the game now has keyboard\/mouse, controller, and touchscreen controls. Right now the only supported controllers are the Xbox 360 controller and Xbox One controller (as I mentioned before they have the same key mappings). I\u2019m hoping to add Playstation controller support if I can get my hands on one.","title":"The Joys of Alternate Control Methods","wayback_source":[]}