Jump to content
  • Advertisement
Sign in to follow this  

Collision detection in actionscript help!

This topic is 4857 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 http://www.miviro.com/cg/ 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(); car.play(); } 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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!