-1

I'm currently trying to detect a collision with a spawned movie clip, shown below;

    function fruitCollide(e:Event):void
    {
        if(player_mc.hitTestObject(myApple))
           {
               trace("Hit!")
                player_mc.removeEventListener(Event.ENTER_FRAME, moveThePlayer);
                currentWordSpawn = "apple";
                spawnText();
           }
}

The things the player is colliding with are defined earlier in the program;

//Movie Clip Spawns
var myApple = new apple();
var myPear = new pear();
var myTomato = new tomato();
var myWatermelon = new watermelon();

The above spawns fine on the screen, however when the player walks over them, nothing happens. The player actually goes behind the spawned fruit, and there is no collision detected.

What have I done wrong? How do I detect a collision with a movie clip spawned via code?

Thanks for any help.

Murphos
  • 25
  • 4

1 Answers1

-1

Didn't have event listeners :^)

That fixed it :D

Murphos
  • 25
  • 4
  • 1
    If you're going to answer your own question, at least make it a good and detailed answer. This is much too vague to be helpful to potential future visitors. – BadFeelingAboutThis May 26 '16 at 15:59