Thanks for the support you guys has gave me. I have another doubts.
In my game I want to insert a image that represents my game over screen. I want this image beginning totally transparent and gradatively will being opaque. So, how can I do this with the OnscreenImage? Is there a way do to this? better, is there other ways to do this? Do I need to put a method in a taskMgr? I have any idea.
The other question is how can I put a sound whe the image be totally opaque?
Fellows, sorry for the big question, I have no idea how can I do any of these things.
hm. guess easyest way would be to set up an lerp-interval which changes your gameovernode.SetColor(1,1,1,0) to (1,1,1,1 )
of course you could also set up a task and do this manually both should work.
Hard ? No, it wasn’t hard at all. Perhaps we should play hard sometimes.
Faster ? guess again.
I only able to see this :
= LerpFunctionInterval inherits from Interval, the step does some Python work
= LerpNodePathInterval inherits from CLerpNodePathInterval, the step is done entirely in C
That doesn’t matter much, but I found an interesting thing. Both of them change RenderAttrib of the node, right ?
The diff is :
seems that CLerpNodePathInterval change the attrib only for nodes being sent to gra’card, while FunctionInterval is done for all nodes (who knows if the func is changing RenderAttrib ?).
See the result of the full-culled race :
from pandac.PandaModules import Vec4
import direct.directbase.DirectStart
from direct.interval.IntervalGlobal import *
for i in range(2000):
s=loader.loadModel('misc/lilsmiley')
s.reparentTo(aspect2d)
s.setPos(render2d,10,0,10)
# fadeIn=s.colorScaleInterval( 3,Vec4(1,1,1,1),Vec4(1,1,1,0) )
# fadeOut=s.colorScaleInterval( 3,Vec4(1,1,1,0) )
# 2000 : 20 fps
fadeIn=LerpFunctionInterval(s.setAlphaScale,3.0,0.0,1.0)
fadeOut=LerpFunctionInterval(s.setAlphaScale,3.0,1.0,0.0)
# 2000 : 8 fps
Sequence( fadeIn,Wait(.5),fadeOut ).loop()
run()