Parent Child Scripting II
Using your knowledge of parent child scripting, try to replicate this movie above. The first thing to do is to create three vector shapes, and place in channels 1, 2 and 3. Then, open a parent script and declare the following properties:
property pChannel, pSpeed, pStart, pRotation
(pChannel will reference the sprite channel your vector shape sits in)
______________________________________________________________________________
If you need some help...read through my scripts below. I have used a neat script called the actorList to initiate all the scripts that move the objects around on stage.
In frame 1, there is a behavior script that reads:
on exitFrame me
barry=new(script "fall", 1, 1,15,1)
joan=new(script "fall", 2,2,200,2)
michael=new(script "fall", 3,10,290,5)
end
In frame 5, there is a behavior script that reads:
on exitFrame me
allMove
--allMove is a custom handler I wrote it's defined next.
go the frame
end
A new movie script, the custom handler, allmove, reads:
on allMove
if count(the actorList) > 0 then
--checks to make sure that something is in fact in the actorlist
repeat with x = 1 to count(the actorList)
animateIt getAt(the actorList, x)
--this script makes the objects fall
blinkit getAt(the actorList, x)
--this script changes the skew and blend of the objects
end repeat
end if
end
The parent script reads:
property pChannel, pSpeed, pStart, pRotation
--four parameters defined
on new me, myChannel, mySpeed, myStart, myRotation
--initialize properties
me.pChannel=myChannel
me. pSpeed=mySpeed
me.pStart=myStart
me.pRotation=myRotation
add the actorList, me
--each instance of an object is added to this special list, called "the actorlist"
return me
end
on animateIt me
if sprite(pChannel).locV > 350 then
sprite(pChannel).locV= 1
else
sprite(pChannel).locV = sprite(pChannel).locV + pSpeed
sprite(pChannel).rotation= sprite(pChannel).rotation+ pRotation
end if
sprite(pChannel).loch = pStart
updatestage
end
on blinkIt me
sprite(pchannel).blend=random(100)
sprite(pchannel).skew=random(200)
end