Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

2D Collisions

Name: Anonymous 2012-12-17 6:09

Help me out. I'm having trouble with 2 Dimensional collision detection in ActionScript 3.

public function isCollidingWithObject (other : GameObject) : Boolean
{
return ( Math.abs((this.position.x + (this.width / 2)) - (other.position.x + (other.width / 2) )) <= this.width + other.width
&& Math.abs((this.position.y + (this.height / 2)) - (other.position.y + (other.height / 2) )) <= this.height + other.height);
}


Why the fuck doesn't this work, I don't understand.

It keeps colliding 40 pixels too early.

Name: Anonymous 2012-12-17 7:43

>>17
wtf I didn't even do that

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List