Rueda de parada y restablecimiento Partical - Motor de física de ActionScript (APE) (último tronco)

StackOverflow https://stackoverflow.com/questions/6023903

Pregunta

Estoy tratando de crear una acción simple de desaparición cuando un articulo de rueda golpea un espacio de círculo de desaparición especial.Normalmente, la carretilla rebota fuera de un montón de otros círculos de círculos, pero cuando el paritcal choca con este círculo CirlParticle, la acción se detiene, se reproduce una animación y cuando se reanuda la acción, muchas partículas circundantes del círculo han disapejado.

El problema es que la carretilla necesita para simplemente caer de una parada completa, pero continúa como si hubiera salido de que se haya rebotado de lo que ahora no existe CirlParticle. Estoy teniendo problemas para eliminar las fuerzas.He intentado iniciar (), Addforce () y cambiando .Velocity Amoung Otras cosas, pero sigue queriendo continuar con el movimiento de rebote lateral.

Estoy usando la última versión troncal de APE para capturar eventos de colisión para el sonido.

package{

import flash.display.MovieClip;
import flash.events.*;  
    import org.cove.ape.*;

public class DropTest extends MovieClip {

    public var self;
    public function DropTest(){
        self = this;

        APEngine.init(0.25);
        APEngine.container = this;
        //APEngine.damping = 0.92;
        APEngine.addForce(new VectorForce(false,0,15));

         var defaultGroup = new Group();
         defaultGroup.collideInternal = true;

         var peg1 = new CircleParticle(10, 30, 5, true, 0.2, 0.3);
         defaultGroup.addParticle(peg1);

          var peg2 = new CircleParticle(35, 30, 5, true, 0.2, 0.3);
         defaultGroup.addParticle(peg2);


         APEngine.addGroup(defaultGroup);           

         peg2.addEventListener(CollisionEvent.COLLIDE, function(evt:CollisionEvent){
                self.removeEventListener(Event.ENTER_FRAME, runAPE);    

                defaultGroup.removeParticle(peg2);
/*  The Wheel needs to stop and drop straight down from here.
                This doesn't seem to work.*/
                wheel.init();

                self.addEventListener(Event.ENTER_FRAME, runAPE);   
         });

        var wheel = new WheelParticle(12, 0, 10, false, 3);
        defaultGroup.addParticle(wheel);

        this.addEventListener(Event.ENTER_FRAME, runAPE);   

    }

    private function runAPE(evt:Event):void {
         APEngine.step();
         APEngine.paint();
      }
}
}

¿Fue útil?

Solución

I think have a solution. I just re-instantiated the WheelParticle

peg2.addEventListener(CollisionEvent.COLLIDE, function(evt:CollisionEvent){
            self.removeEventListener(Event.ENTER_FRAME, runAPE);    

            defaultGroup.removeParticle(peg2);
/*  The Wheel needs to stop and drop straight down from here.
            This doesn't seem to work.*/

           //  Replace with this
            defaultGroup.removeParticle(wheel);
            wheel = new WheelParticle(wheel.px,  wheel.px, 10, false, 3);
            defaultGroup.addParticle(wheel);


            self.addEventListener(Event.ENTER_FRAME, runAPE);   
 });

The only problem now is that the rotation of the wheel changes when you re-instantiate it.

Is there a way to manually change the rotation?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top