Search Results

Search found 1 results on 1 pages for 'user18080'.

Page 1/1 | 1 

  • Enemy collision detection with movie clips

    - by user18080
    I have created multiple movieclips with animations within them. It is an obstacle avoidance game and I cannot seem to be able to get my enemies to contact my playableCharacter. The enemies I have created are each embedded on certain levels of my game. I have created an array, enemiesArray to have each of my enemies placed within it. Here is the code for that: //step 1: make sure array exists if(enemiesArray!=null && enemiesArray.length!=0) { //step 2: check all enemies against villain for(var i:int = 0;i < enemiesArray.length; i++) { //step 3: check for collision if(villain.hitTestObject(enemiesArray[i])) { //step 4: do stuff trace("HIT!"); removeChild(enemiesArray[i]); enemiesArray.splice(i,1); removeChild(villain); villain = null; } } } What I am unsure of is whether or not my enemiesArray is actually holding the movieclips I have suggested. If it was, this code would be tracing back a "HIT" for every time I ran into an enemy and would kill my character. It is not doing that however. I am thinking I have to push my movieclips into my array but I don't know how to do that or where for that matter. Any and all help would be much appreciated.

    Read the article

1