QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _MOUSEMOVEMENTY function returns the relative vertical position of the mouse cursor as positive or negative values.

Syntax

verticalMove = _MOUSEMOVEMENTY

Example(s)

MOD is used to keep vertical movement of circle and cursor inside of the SCREEN 13 window(200).


SCREEN 13, , 1, 0
DO: _LIMIT 200
  DO WHILE _MOUSEINPUT
    x = x + _MOUSEMOVEMENTX
    y = y + _MOUSEMOVEMENTY
  LOOP
  x = (x + 320) MOD 320 'keeps object on screen
  y = (y + 200) MOD 200 'remove if off screen moves are desired
  CLS
  CIRCLE (x, y), 20
  PCOPY 1, 0
LOOP UNTIL INKEY$ <> "" 'press any key to exit 

NOTE: When using the function this way, give the user a keypress exit option. Make sure the user has some way to exit that is not dependent on clicking the X button.

See Also