home *** CD-ROM | disk | FTP | other *** search
/ Imaginemos! 2 / Imaginemos2.iso / PC / PRETEND2.EXE / PAINT.DXR / 00007.ls < prev    next >
Encoding:
Text File  |  1996-09-10  |  2.3 KB  |  95 lines

  1. on drawit
  2.   global x1, y1, x2, y2, lastx, lasty, pensize, clrsprite, lft, rgt, tp, btm, newcolor
  3.   set clrsprite to 47
  4.   puppetSprite(clrsprite, 1)
  5.   set the foreColor of sprite clrsprite to newcolor
  6.   if lastx > x1 then
  7.     if lastx < x2 then
  8.       if lasty > y1 then
  9.         if lasty < y2 then
  10.           set tp to lasty - pensize
  11.           set lft to lastx - pensize
  12.           set rgt to lastx + pensize
  13.           set btm to lasty + pensize
  14.           if lft < x1 then
  15.             set lft to x1
  16.           end if
  17.           if btm > y2 then
  18.             set btm to y2
  19.           end if
  20.           if tp < y1 then
  21.             set tp to y1
  22.           end if
  23.           if rgt > x2 then
  24.             set rgt to x2
  25.           end if
  26.           set the visible of sprite clrsprite to 1
  27.           if pensize = 1 then
  28.             set the locH of sprite clrsprite to lft
  29.             set the locV of sprite clrsprite to tp
  30.           else
  31.             spriteBox(clrsprite, lft, tp, rgt, btm)
  32.           end if
  33.           set the castNum of sprite clrsprite to 45
  34.           updateStage()
  35.           set the locH of sprite clrsprite to -2000
  36.           set the locV of sprite clrsprite to -2000
  37.         end if
  38.       end if
  39.     end if
  40.   end if
  41.   puppetSprite(clrsprite, 1)
  42. end
  43.  
  44. on exitFrame
  45.   global lastx, lasty, thisx, thisy, newcolor, pensize
  46.   set thisx to the mouseH
  47.   set thisy to the mouseV
  48.   if pensize > 0 then
  49.     repeat while the mouseDown
  50.       set thisx to the mouseH
  51.       set thisy to the mouseV
  52.       if (thisx <> lastx) or (thisy <> lasty) then
  53.         if the mouseDown then
  54.           set lastx to thisx
  55.           set lasty to thisy
  56.           drawit()
  57.         end if
  58.       end if
  59.     end repeat
  60.   end if
  61.   set lastx to thisx
  62.   set lasty to thisy
  63.   go(the frame)
  64. end
  65.  
  66. on mouseUp
  67.   global x1, y1, x2, y2, thisx, thisy, pensize, clrsprite
  68.   puppetSprite(2, 1)
  69.   set the trails of sprite 2 to 1
  70.   set the locH of sprite 2 to -1610
  71.   set the locV of sprite 2 to -1610
  72.   updateStage()
  73.   if pensize = 0 then
  74.     fillit()
  75.   else
  76.     set the ink of sprite 2 to 36
  77.     set the visible of sprite 2 to 1
  78.     spriteBox(2, x1, y1, x2, y2)
  79.     updateStage()
  80.     puppetSprite(2, 0)
  81.   end if
  82.   updateStage()
  83. end
  84.  
  85. on mouseDown
  86.   global lastx, lasty, thisx, thisy, pensize
  87.   set thisx to the mouseH
  88.   set thisy to the mouseV
  89.   if pensize > 0 then
  90.     set lastx to thisx
  91.     set lasty to thisy
  92.     drawit()
  93.   end if
  94. end
  95.