[EMAIL PROTECTED] wrote:
> I want a special sprite to change blendlevel on a special frame. How do I
> do that?
Best with a behavior attached to the desired sprite. Thus, sending messages
to your sprite to initiate the blend process running in its "on exitFrame
me" event handler to avoid repeat loops.
Your behavior would look somehow like:
(Beware: email lingo/untested)
--
property pActionSprite, pBlendValue, pBlendInteger
property pProcessBlending, me.pBlendProc
on BlendIn me
me.pBlendProc = #in
me.pProcessBlending =TRUE
end
on BlendOut me
me.pBlendProc = #out
me.pProcessBlending =TRUE
end
on beginSprite me
-- reset everything and clean up to start...
sprite(me.pActionSprite).blend = 0
me.pBlendValue = 0
me.pBlendInteger = 10
me.pProcessBlending = FALSE
me.pBlendProc = #in
end
-- idle handling...
on exitFrame me
case (me.pProcessBlending) of
TRUE: -- we're busy
case (me.pBlendProc) of
#in: -- if we blend in...
-- last cycle?
case ((me.pBlendValue + me.pBlendInteger = 100) OR (me.pBlendValue
= 100)) of
TRUE: me.pProcessBlending = FALSE
end case
me.pBlendValue = sprite(me.pActionSprite).blend + me.pBlendInteger
sprite(me.pActionSprite).blend = me.pBlendValue
updateStage
#out: -- if we blend out...
-- last cycle?
case ((me.pBlendValue - me.pBlendInteger = 0) OR (me.pBlendValue =
0)) of
TRUE: me.pProcessBlending = FALSE
end case
me.pBlendValue = sprite(me.pActionSprite).blend - me.pBlendInteger
sprite(me.pActionSprite).blend = me.pBlendValue
updateStage
end case
end case
end
on getPropertyDescriptionList me
if not the currentSpriteNum then
-- behavior has been attached to script channel
exit
end if
vPDList = [:]
setaProp vPDList, #pActionSprite, [#comment: "Action Sprite:", #format:
#integer, #default: (the currentSpriteNum)]
return vPDList
end getPropertyDescriptionList
--
Then, you can simply send messages to your behavior, like:
sendSprite(1,#BlendIn) -- to blend in
or...
sendSprite(1,#BlendOut) -- to blend out
All the best
Dominik
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]