Roue d'arrêt et de réinitialisation Partieux - Moteur de physique ActionScript (APE) (Dernier coffre)

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

Question

J'essaie de créer une simple action disparante lorsqu'un peluche d'eau frappe un cercle de cercle de disparition spécial.Normalement, l'éambère rebondit d'un bouquet d'autres périlleuses, mais lorsque le WheelParitcal se heurte à ce cercleParticle, l'action pause, une animation joue et lorsque l'action reprend, de nombreuses particules de cercle entourant ont disparu.

Le problème est que la pionnière doit simplement tomber d'une butée complète, mais elle continue comme si vous venez de rebondir de la part de cercle, maintenant non existant. J'ai du mal à éliminer les forces.J'ai essayé init (), addforce () et changeant .velocity amoung Autres choses, mais il continue à vouloir continuer le mouvement rebondissant latéral.

J'utilise la dernière version du coffre de l'APE afin de capturer des événements de collision pour son son.

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();
      }
}
}

Était-ce utile?

La solution

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?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top