Skip to content
Narta Xaymar Dirks edited this page Oct 30, 2026 · 7 revisions

Blitz3DBlitzPlusBlitzBasic

JoyX

JoyX:Float32 port:Int32=0
Parameter Mode Type Default Description
port In Int32 0 The joystick to ask, counted from 0. Defaults to 0.

Returns: The position from -1 to 1, or 0 if there is no joystick.

Description

The horizontal position of the main stick, from -1 (left) to 1 (right). A small value close to 0 is normal even when the stick is released, so ignore values below a dead zone of about 0.1.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Cls
Color 90, 90, 90
Oval 80, 40, 160, 160, 0
Color 255, 200, 0
Oval 160 + JoyX() * 70 - 10, 120 + JoyY() * 70 - 10, 20, 20, 1
Color 255, 255, 255
Text 160, 215, "JoyX " + JoyX() + "  JoyY " + JoyY(), 1, 1
Flip
WaitKey

Media

JoyX

Related Commands

JoyChanged, JoyDeviceConnected, JoyDeviceCount, JoyDeviceName, JoyDown, JoyHat, JoyHit, JoyXDir

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally