예제 #1
0
    def update(self):
        FlxCore.update(self)
        for i in range(len(self._children)):

            if ((self._children[i] != None) and self._children[i].exists
                    and self._children[i].active):
                self._children[i].update()
예제 #2
0
 def update(self):
     self.last.x=self.x
     self.last.y=self.y
     #print "last",self,self.last.x,self.last.y
     FlxCore.update(self);
     
     if(not self.active): 
         return;
     
     #animation
     if((self._curAnim != None) and (self._curAnim.delay > 0) and (self._curAnim.looped or not self.finished)):
         self._frameTimer += FlxG.elapsed;
         #print self._frameTimer,self._curAnim.delay,FlxG.elapsed
         #raw_input()
         if(self._frameTimer > self._curAnim.delay):
             self._frameTimer -= self._curAnim.delay;
             if(self._curFrame == len(self._curAnim.frames)-1):
                 if(self._curAnim.looped):
                     self._curFrame = 0;
                 self.finished = true;
             else:
                 self._curFrame+=1;
             self.calcFrame();
             #print "curframe",self._curFrame
     
     #motion + physics
     self.angularVelocity = FlxG.computeVelocity(self.angularVelocity,self.angularAacceleration,self.angularDrag,self.maxAngular)
     self.angle += (self.angularVelocity)*FlxG.elapsed;
     self.thrustComponents=FlxPoint();
     if(self.thrust != 0):
         self.thrustComponents = FlxG.rotatePoint(-self.thrust,0,0,0,self.angle);
         maxComponents = FlxG.rotatePoint(-maxself.thrust,0,0,0,self.angle);
         maxself.velocity.x = Math.abs(maxComponents.x);
         maxself.velocity.y = Math.abs(maxComponents.y);
     else:
         self.thrustComponents = self._pZero;
     self.velocity.x = FlxG.computeVelocity(self.velocity.x,self.acceleration.x+self.thrustComponents.x,self.drag.x,self.maxVelocity.x)
     self.x += (self.velocity.x)*FlxG.elapsed;
     self.velocity.y = FlxG.computeVelocity(self.velocity.y,self.acceleration.y+self.thrustComponents.y,self.drag.y,self.maxVelocity.y)
     self.y += (self.velocity.y)*FlxG.elapsed;
예제 #3
0
 def update(self):
     FlxCore.update(self);
     for i in range( len(self._children)):
        
         if((self._children[i] != None) and self._children[i].exists and self._children[i].active):
             self._children[i].update();