isLeftDown

.isLeftDown()

Return true if the left mouse button is currently down, and false on all other occasions. This is regardless of if it was pressed on this frame, or a previous one.

.isLeftDown() { |x, y| ... }

You can also attach a block onto 'isLeftDown', and the current mouse x and y location will be passed into the block if the left mouse button is currently down.

/* Moves the player to the current mouse location,
 * when the mouse button is down. */
getControls().isLeftDown() do |x, y|
    player.setLocation( x, y )
end

See also

isRightDown - isMiddleDown - isLeftClick - isLeftPressed