-- 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
on getBehaviorDescription me
return ("This behaviour written by NoiseCrime 14 sept 1999")
end
on getPropertyDescriptionList me
set description = [:]
addprop description, #NCXplodeTime, [#comment: "XplodeTime in seconds",#format: #integer ,#range: [#min: 1, #max: 20], #default: 3]
-- addprop description, #castEnd, [#comment: "Roll On: Sequence member End",#format: #integer, #default: 0]
-- addprop description, #castlist, [#comment: "Roll On: Sequence list of member numbers",#format: #string, #default: ""]
return description
end
on beginsprite me
-- set up other varibles
set NCXplodeTime to (NCXplodeTime *1000) -- convert time from seconds to milliseconds
set NCXplodeTime to NCXplodeTime + (random(10)*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 xtemp
set NClocY to ytemp
-- determine the movement increments
set NCdx to (NClocX-NCfinalLOC[1])/float(NCXplodeTime)
set NCdy to (NClocY-NCfinalLOC[2])/float(NCXplodeTime)
-- move the sprite to its offscreen position
set the loc of sprite NCchannel to point(NClocX,NClocY)
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)
-- 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 NClocX to NCfinalLOC[1]
set NClocY to NCfinalLOC[2]
end if
set the loc of sprite NCchannel to point(integer(NClocX),integer(NClocY))
end
on checkArrived me
return NCarrivedFLAG
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA