Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
What is the difference between Director and Flash?
TAGGuard
ESCAPE Video Studio
Rotate Click-Alphamania
Puzzler
Set Properties of a Flash Sprite
TrackTheColors Xtra Error
Hangman
Display the cursors position
Set Display Properties
MediaMacros Xtras Mall
 

 

 

Behavior Drifter

Added on 7/1/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC

This item has not yet been rated

Author: ColeTierney

A behavior that gives a sprite kinetic motion and can be thrown around From Cole Tierney"s Code Corner http://homepages.together.net/%7Etierney/cole/code/

property spriteNum, state, lastLoc, deltaV, mouseOffset, pinnedLoc

on beginSprite                   -- Start out drifting (just not going anywhere).
  set deltaV = point( 0, 0 )
  set state = #drifting
end

on mouseDown me                  -- Now change state to #dragging.
  set mouseOffset = the loc of sprite spriteNum - point( the mouseH, the mouseV )
  set state = #dragging
end

on exitFrame me  
  set pinnedLoc = point( the mouseH, the mouseV ) + mouseOffset
  call( state, me )              -- Call whatever state we are in.  
  go the frame
end

-- State methods.
--
on dragging me  
  if NOT the mouseDown then
    set state = #drifting        -- Move back to drifting state.
    set deltaV = pinnedLoc - lastLoc
  else
    set lastLoc = the loc of sprite spriteNum
    set the loc of sprite spriteNum = pinnedLoc
  end if  
end

on drifting me  
  set the loc of sprite spriteNum = the loc of sprite spriteNum + deltaV  
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail