X
GO
en-USen-GBfr-FRes-ESit-ITnn-NOsv-SE
AMOS 2 Articles
Apr
06
2019

Gamepads and Joysticks

Posted 46 days ago ago by Admin     0 Comments
Admin

0 Great article! Great article! I'm neutral on this

Gamepads and Joysticks!

Today I implemented support for gamepad in AMOS 2. Of course, the old JUp/JDown/JLeft/JRight/Fire are there, but you also have new functions to deal with modern gamepads, and retreive in a simple way all the information they provide, buttons, axes and triggers.

Waiting for your games! :)

 

## *AMOS 2 Compiler version 0.2 - 04/04/2019*

Implementation of joystick and gamepads! Have a look at the 'debugging' application contained in the distribution...

### New
- = JUp
- = JDown
- = JRight
- = JLeft
- = Fire
- = Gamepad Connected( PADNUMBER ) ***NEW IN AMOS2!***

   PADNUMBER is an integer with a value from 1 to 4, you can connect up to 4 gamepads to the machine...

   Returns TRUE if the gamepad is connected.

- = Gamepad Button( PADNUMBER, BUTTONNUMBER ) ***NEW IN AMOS2!***

   BUTTONNUMBER is an integer number from 0 to 15, with the following mapping of the buttons:
- 0 : Bottom button in right cluster ('A' on XBox controller, Fire)
- 1 : Right button in right cluster ( 'B' on XBox controller)
- 2 : Left button in right cluster ('X' on XBox controller)
- 3 : Top button in right cluster ('Y' on XBox controller)
- 4 : Top left front button
- 5 : Top right front button
- 6 : Bottom left front button
- 7 : Bottom right front button
- 8 : Left button in center cluster (gamepad left 'control' button)
- 9 : Right button in center cluster (gamepad right 'control' button)
- 10 : Left stick pressed button
- 11 : Right stick pressed button
- 12 : Top button in left cluster (JUp)
- 13 : Bottom button in left cluster (JDown)
- 14 : Left button in left cluster (JLeft)
- 15 : Right button in left cluster (JRight)

- = Gamepad Axe( PADNUMBER, AXENUMBER ) ***NEW IN AMOS2!***

   AXENUMBER is an integer number from 0 to 3, indicating which axe to report. The function returns a floating point value from -1 to 1.
- 0 : Horizontal axis for left stick
- 1 : Vertical axis for left stick
- 2 : Horizontal axis for right stick
- 3 : Vertical axis for right stick

- = Gamepad Trigger( PADNUMBER, TRIGGERNUMBER ) ***NEW IN AMOS2!***

   TRIGGERNUMBER is an integer number from 0 to 1, indicating which trigger to report. The function returns a floating point value from 0 to 1.
- 0 : Left trigger
- 1 : Right trigger

### Bugs removed
- Bob Off NUMBER and Sprite Off NUMBER do not generate an error anymore if the Bob or Sprite did not exist






No Comments



You need to login to comment.