Teleport Fx - [ build in / dissolve out + bloom threshold ]

Teleport Fx - [ build in / dissolve out + bloom threshold ]


import bge

def myRound(x, prec=2, base=.05):
  return round(base * round(float(x)/base),prec)


def main():


    cont = bge.logic.getCurrentController()
    own = cont.owner
    keyboard = cont.sensors['Keyboard']
    max = 320
    min = 100
    inc = 1
    
    if own['frame']>max:
        own['frame']=max
    if own['frame']<min:
        own['frame']=min
    if keyboard.positive and own['Bool']==True and own['frame']==max:
        own['Bool']=False
        own['frame']=max-inc
        
    if keyboard.positive and own['Bool']==False and own['frame']==min:
        own['Bool']=True
        own['frame']=inc
        
    if own['frame']<=max-inc and own['Bool']==True and own['frame']>=inc :
        own['frame']+=inc
      
    if own['frame']>=inc and own['Bool']==False and own['frame']<max:
        own['frame']-=inc
        
    
    own.color = [2-own['frame']*.01,2-own['frame']*.01,2-own['frame']*.01,2-own['frame']*.01]
    if own.color[0]<.0125 or own.color[0]>.975:
        own.parent.color = [2-own['frame']*.01,2-own['frame']*.01,2-own['frame']*.01,2-own['frame']*.01]
    else:
        
        if bge.logic.getRandomFloat()>.5:
            own.parent.color = [1,1,1,1]
        else:
            own.parent.color = [2-own['frame']*.01,2-own['frame']*.01,2-own['frame']*.01,2-own['frame']*.01]
                
main()




Attachments

Teleport_fx3B.blend (699 KB)