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
-- 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
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