Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 1.25 KB | Hits: 50 | Expires: Never
Copy text to clipboard
  1. -- GLOBAL VARIABLE DEFINITIONS
  2. global gMap
  3. global gMapEditor
  4.  
  5.  
  6. on mouseDown(me)
  7.   repeat while _mouse.mouseDown
  8.     me.drawOnMap(#unblocked)
  9.   end repeat
  10. end mouseDown
  11.  
  12.  
  13. on rightMouseDown(me)
  14.   repeat while _mouse.rightMouseDown
  15.     me.drawOnMap(#blocked)
  16.   end repeat
  17. end rightMouseDown
  18.  
  19.  
  20. on drawOnMap(me, type)
  21.   if (voidP(type)) then type = #unblocked
  22.   case (gMapEditor.getClickType()) of
  23.     #tile:
  24.       data = gMap.getData()
  25.       layer = gMapEditor.getLayerNumber()
  26.       brush = gMapEditor.getBrushType()
  27.       tile = gMapEditor.getSelectedTile()
  28.       clickXY = convertPos(#LocToXY, _mouse.mouseH, _mouse.mouseV)
  29.       if ((clickXY.X < 1) or (clickXY.X > 17) or (clickXY.Y < 0) or (clickXY.Y > 12)) then exit
  30.       case (brush) of
  31.         #pencil:
  32.           data[layer][clickXY.Y][clickXY.X] = tile
  33.         #fill:
  34.           repeat with i = 1 to 12
  35.             repeat with j = 1 to 17
  36.               data[layer][i][j] = tile
  37.             end repeat
  38.           end repeat
  39.       end case
  40.       coords = [clickXY.X, clickXY.Y]
  41.       if (type = #blocked) then
  42.         gMap.addToBlockedTiles(coords)
  43.       else
  44.         gMap.removeFromBlockedTiles(coords)
  45.       end if
  46.       gMap.setData(data, #mapeditor_load)
  47.   end case
  48. end drawOnMap