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
merge sorting including accent marked strings
2state Button with Cursor change and Sound
Copy Keydown Script
Tic Tac Toe
Behavior Documentor
Grabber
Text Pop Up
KK
Multi Cropper
Interface Colors in all palettes
 

 

 

Behavior Xplode that text

Added on 5/20/2000

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: Noisecrime

Part of the Xploding Text behaviors. Full set includes Xploding Text Prepare Movie, De-Xplode Text position relative, De-Xplode Random, Xplode Text, De-Xplode Button, and Wait for Xplode to finish

Download PC Source    Download Mac Source
-- Xplodingtext by Noisecrime 14 Sept 1999 @ NOISECRIME PRODUCTIONS

-- EMAIL: simtek@dircon.co.uk

-- THIS BEHAVIOUR IS FREE TO USE
-- IF YOU USE ALL OR ANY PART OF THESE BEHAVIOURS, YOU MUST LEAVE IN THE ACKNOWLEDGEMENT TO NOISECRIME PRODUCTIONS WITHIN THE BEHAVIOURS
-- ALSO YOU MUST ACKNOWLEDGE ADDITIONAL PROGRAMING BY NOISECRIME IN THE CREDITS


-- NOTE this is quite generic, and could easily be speed up, by taking the NClastmill out of the behaviour and making it a global, with it being set
-- in the loop behaviour, and being in all begin sprites

-- NOTE THIS BEHAVIOUR SIMPLY REVERSES THE DE-EXPLODE

on getBehaviorDescription me
  return ("This behaviour written by NoiseCrime 14 sept 1999" & RETURN & "This one looks at the end location to base where the letter starts from offscreen")
end

property NCchannel
property NCfinalLOC
property NClocX
property NClocY
property NCXplodeTime
property NCdx
property NCdy
property NCarrivedFLAG
property NCendTIME
property NClastmilli

property NCrotation, NCrotationR

-- property  winH, winV
global NCwinH, NCwinV

on getPropertyDescriptionList me
  set description = [:]  
  addprop description, #NCXplodeTime, [#comment: "XplodeTime in seconds",#format:  #integer ,#range:  [#min: 1, #max: 20], #default:  3]  
  return description
end


on beginsprite me
  --  These should be kept as globals, created in startmovie, but could be added here.
  --  set winH to (the stageright- the stageleft)/2
  --  set winZ to (the stageright- the stageleft)/2  
  
  -- set up other varibles
  set NCXplodeTime to NCXplodeTime *1000                -- convert time from seconds to milliseconds
  set NCXplodeTime to NCXplodeTime + (random(20)*50)    -- Comment out this line to have the word formed at the same time. Better to leave it in.
  
  set NClastmilli to the milliseconds                   -- Used to determine time elapsed, and therefore distance to move  dist = (speed*time)
  set NCendTIME to NClastmilli + NCXplodeTime           -- Used to determine if the letter should have arrive at final position
  set NCarrivedFLAG to 0                                -- Flag to indicate that the letter  has arrived
  
  set NCchannel  to the spritenum of me                 -- store this sprite channel
  set NCfinalLOC to the loc of sprite NCchannel        --  store the target position
  
  -- set up a random position
  set xtemp to random(50)
  set ytemp to random(50)
  
  if random(10) < 5  then
    set xtemp to the stageright + xtemp
  else
    set xtemp to -xtemp
  end if
  
  if  random(10) < 5 then
    set ytemp to the stagebottom + ytemp
  else
    set ytemp to -ytemp
  end if
  
  -- set current offscreen location
  set NClocX to NCfinalLOC[1]
  set NClocY to NCfinalLOC[2]
  
  -- determine the movement increments
  set NCdx to (xtemp-NCfinalLOC[1])/float(NCXplodeTime)  
  set NCdy to (ytemp-NCfinalLOC[2])/float(NCXplodeTime)
  
  set NCrotation to (random(10)*45)+360
  set NCrotationR to NCrotation/float(NCXplodeTime)  
end



on exitframe me
  if NCarrivedFLAG then exit
  
  -- calculate time has passed
  set NCtimelapsed to the milliseconds - NClastmilli
  if NCtimelapsed > 200 then set NCtimelapsed to 200  -- fixes time for slow machines
  
  set NClastmilli to the milliseconds
  
  set NClocX = NClocX + (NCdx*NCtimelapsed)
  set NClocY = NClocY + (NCdy*NCtimelapsed)
  set NCrotation to NCrotation - (NCrotationR*NCtimelapsed)
  
  -- Check if the the letter has been moving for set time peroid. If yes then fix its position to the final position
  if NCendTIME < NClastmilli then set NCarrivedFLAG to 1
  
  set the loc of sprite NCchannel to point(integer(NClocX),integer(NClocY))
  set the rotation of sprite NCchannel to NCrotation
end

on checkArrived me
  return NCarrivedFLAG
end

 


Contact

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

Send e-mail