Skip to content

title: "Joystick" description: TRSE built-in method (from IDE help)


Joystick

Systems: C64, MEGA65, PLUS4, C128, VIC20, OK64
Parameters: n


Joystick( [numeric value 1] );

  • [numeric value 1] - Joystick port number. Expects a value of 1 or 2 for the respective port.

Description

Reads the input from joystick from port 1 or 2 and populates the internal TRSE joystick variables.

  • joystickleft
  • joystickright
  • joystickdown
  • joystickup
  • joystickbutton

Example

Joystick(1); // Read joystick port 1 input // Perform some movement if (joystickleft=1) then map_player_direction:=map_player_direction-1; if (joystickright=1) then map_player_direction:=map_player_direction+1; if (joystickdown=1) then map_player_direction:=map_player_direction+40; if (joystickup=1) then map_player_direction:=map_player_direction-40; // Button if (joystickbutton=1) then Shoot(); Joystick(2); // Read joystick port 2 input ...

See also readjoy1() and readjoy2().