Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
display TreeView
Merge sort and Binary Search using Lingo
Play/Pause/Rewind Video Sprite
SpriteMap
Made with Macromedia and Shockwave Licensing Programs
myWallpaper
Prevent Hour Glass Cursor after AVI Ends
ColorCursor
xTray xtra
File Open Dialog Behavior
 

 

 

Behavior JTMR Digital Painter

Added on 4/12/2000

 

Compatibilities:
behavior D8 Mac PC Shockwave

This item has not yet been rated

Author: ElianChrebor

This behavior gives the illusion of the computer slowly painting a picture.

Download PC Source    Download Mac Source
-- JTMR
-- DIGITAL
-- PAINTER
-- ==================================================
-- JTMR Digital Painter
-- Gives an 'artificial' life to the brush sprite.
-- ==================================================
-- © 2000 - JTMR
-- ==================================================

-- globals

-- properties
property movementLength, movementPressure, drawingRect, modelMember
property status
property initialLoc, currentMovementLength, blendStep

-- scripts
on beginSprite me
  -- checks whether modelMember is a valid member
  if me.modelMember.type <> #bitmap then
    alert "You did not choose a correct model..."
    me.status = #error
    return 0
  end if
  if me.modelMember.depth > 8 then
    alert "The model depth must be 8 bits..."
    me.status = #error
    return 0
  end if
  sprite(me.spriteNum).ink = 36
  sprite(me.spriteNum).trails = 1
  -- Initializes painting parameters
  JTMRinit(me)
end beginSprite

on JTMRinit me
  me.initialLoc = point(random(me.modelMember.width), random(me.modelMember.height))
  me.currentMovementLength = random(me.movementLength)
  sprite(me.spriteNum).forecolor = getPixel(me.modelMember, me.initialLoc[1], me.initialLoc[2])
  me.blendStep = 100/me.movementLength
  sprite(me.spriteNum).loc =  point(me.drawingRect[1], me.drawingRect[2]) +  me.initialLoc
  if sprite(me.spriteNum).locH > me.drawingRect[3]  OR sprite(me.spriteNum).locV > me.drawingRect[4] then JTMRInit(me)
end JTMRinit

on prepareFrame me
  if me.status = #error then return 0
  sprite(me.spriteNum).locH = sprite(me.spriteNum).locH + (21-me.movementPressure)
  if sprite(me.spriteNum).locH - me.drawingRect[1]> min(me.modelMember.width, me.initialLoc[1] + me.currentMovementLength) then
    JTMRinit(me)
  end if
  sprite(me.spriteNum).blend = sprite(me.spriteNum).blend - me.blendStep
end prepareFrame

-- ==================================================
on getPropertyDescriptionList
  myRealStageRect = rect(0,0, the stageRight - the stageLeft, the stageBottom - the stageTop)
  myPropertylist = [:]
  addProp myPropertyList, #movementLength, [#Comment: "Movement Length (max value)", #format: #integer, #range: [#min: 1, #max: 50], #default: 20]
  addProp myPropertyList, #movementPressure, [#Comment: "Movement Pressure (max value)", #format: #integer, #range: [#min: 1, #max: 20], #default: 15]
  addProp myPropertyList, #drawingRect, [#Comment: "Drawing rect (rect value)", #format: #rect, #default: myRealStageRect]
  addProp myPropertyList, #modelMember, [#Comment: "Model Member (8 bits bitmap member)", #format: #bitmap, #default: 0]
  return myPropertyList
end getPropertyDescriptionList

on getBehaviorDescription
  return "JTMR Behavior Library" & RETURN &¬
         "© 2000 - JTMR" & RETURN &¬
         "jtmr@worldnet.fr" & RETURN &¬
         "http://services.worlddnet.fr/elian-c" & RETURN & RETURN &¬
         "JTMR Digital Painter" & RETURN &¬
         "Gives an 'artificial' life to the brush sprite." & RETURN & RETURN &¬
         "This behavior is free software; you can redistribute it and/or modify "  &¬
         "it under the terms of the GNU General Public License as published by "  &¬
         "the Free Software Foundation; either version 2 of the License, or (at "  &¬
         "your option) any later version. "  &¬
         "This program is distributed in the hope that it will be useful, but "  &¬
         "WITHOUT ANY WARRANTY; without even the implied warranty of "  &¬
         "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU "  &¬
         "General Public License for more details. "  &¬
         "You should have received a copy of the GNU General Public License "  &¬
         "along with this program; if not, write to the Free Software "  &¬
         "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
end getBehaviorDescription
-- ==================================================

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail