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
Windows NT and Audio
Res Mode
Vector Shape - Create Frame
Asteroids Game
Progress Bar
DaoX
Go to Different Movie
Writing HTML in Text member
Basic 4 direction environment navigation
Password Field
 

 

 

Behavior More Maze Handlers

Added on 6/30/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC

This item has not yet been rated

Author: LonKoenig

Maze handler script. The visible sprites are placed using Matte Ink.

on mouseDown
  -- Constants:
  set hiddenSprite=48   -- Channel used to pre-test object"s location
  set mapSprite=1       -- Map of allowable area
  set testX=the mouseH  -- save the mouse position RIGHT NOW!
  set testY=the mouseV
  set me to the clickOn -- Remember which channel this object is using
  -- Calculate the mouse"s offset from the object"s registration point
  set offsetestX to the locH of sprite me
  set offsetestY to the locV of sprite me
  set offsetestX=offsetestX-testX
  set offsetestY=offsetestY-testY
  set the castNum of sprite hiddenSprite to the castNum of sprite me
  set the visible of sprite hiddenSprite to FALSE
  set goodX=the mouseH+offsetestX
  set goodY=the mouseV+offsetestY
  --Track the movement:
  repeat while the stillDown
    -- Test for the collision:
    set testX=the mouseH+offsetestX
    set testY=the mouseV+offsetestY
    set the loc of sprite hiddenSprite to point(testX, testY)
    updateStage
    if (sprite hiddenSprite within mapSprite) then
      set the loc of sprite me to point(testX, testY)
      set goodX=testX
      set goodY=testY
    else
      set the loc of sprite me to point(goodX, goodY)
      updateStage
    end if
  end repeat
end mouseDown

 


Contact

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

Send e-mail