Sign in to follow this  
yayo_99

Collision detection in actionscript help!

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this