Advertisement Jump to content
Sign in to follow this  

Collision detection in actionscript help!

This topic is 4951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I want that my enemy cars don't overlap, this is the link this is my enemy layer: createEnemy = function(type, x, y) { var nm = "enemy" + enemyCount; enemyLayer.attachMovie(type, nm, enemyCount); enemyLayer[nm]._x = x; enemyLayer[nm].xline = x; enemyLayer[nm]._y = y; enemyLayer[nm].dy = Math.random() * 3 + 10; enemyLayer[nm].onEnterFrame = function() { this._x = this.xline; this._y += this.dy; if (this._currentframe == 1 && car.hitTest(this._x, this._y, true)) { counter = 1; doCounter();; } if (this._y > 750) this.removeMovieClip(); } enemyCount ++; enemyCount %= 10; } ok, and, inside this, i want to put: if ((enemyLayer("bob", x, y)).hitTest((enemyLayer("bus", x, y)),true)) { trace ("collision!!"); } I'm not right cause it doesn't work, but am I close?? thank u guys!!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!