Module ...

Handles player default mouse actions Defines some methods to help use the mouse in an uniform way in all modules

Functions

_M:mouseHandleDefault (key, allow_move, button, mx, my, xrel, yrel, event) Handles global mouse event This will handle events like this: Left click: player mouse movement Shift + left click: map scroll Any other click: pass on the click as a key event, to allow actions to be bound to the mouse
_M:mouseMove (tmx, tmy, spotHostiles, astar_check, force_move) Runs to the clicked mouse spot if no monsters in sight it will try to make an A* path, if it fails it will do a direct path
if there are monsters in sight it will move one stop in the direct path direction
this method requires to use PlayerRun interface
_M:mouseScrollMap (map, xrel, yrel) Handles mouse scrolling the map


Functions

_M:mouseHandleDefault (key, allow_move, button, mx, my, xrel, yrel, event)
Handles global mouse event This will handle events like this: Left click: player mouse movement Shift + left click: map scroll Any other click: pass on the click as a key event, to allow actions to be bound to the mouse

Parameters

  • key: the Key object to which to pass the event if not treated, this should be your game default key handler probably
  • allow_move: true if this will allow player movement (you should use it to check that you are not in targetting mode)
  • button:
  • mx:
  • my:
  • xrel:
  • yrel:
  • event:
_M:mouseMove (tmx, tmy, spotHostiles, astar_check, force_move)
Runs to the clicked mouse spot if no monsters in sight it will try to make an A* path, if it fails it will do a direct path
if there are monsters in sight it will move one stop in the direct path direction
this method requires to use PlayerRun interface

Parameters

  • tmx: the coords clicked
  • tmy: the coords clicked
  • spotHostiles: a function taking only the player as a parameter that must return true if hostiles are in sight
  • astar_check: nil or a function to check each tile on the astar path for passability
  • force_move:
_M:mouseScrollMap (map, xrel, yrel)
Handles mouse scrolling the map

Parameters

  • map: the Map to scroll
  • xrel: the x movement velocity, gotten from a mouse event
  • yrel: the y movement velocity, gotten from a mouse event

Valid XHTML 1.0!