00:00
00:00
TheSongSalad

Male

CU Boulder

Colorado

Joined on 1/17/09

Level:
19
Exp Points:
3,810 / 4,010
Exp Rank:
13,610
Vote Power:
6.09 votes
Rank:
Private
Global Rank:
3,346
Blams:
924
Saves:
1,741
B/P Bonus:
18%
Whistle:
Bronze
Medals:
322

flash issues....

Posted by TheSongSalad - February 16th, 2009


well, if anyone looks at this, i'm having issues with my flash game's hit detection... this is the code if anyone wants to help.:

onClipEvent(EnterFrame){
if (Key.isDown(Key.RIGHT)) {
this._x += 10;
} else if (Key.isDown(Key.LEFT)) {
this._x -= 10;
}
if (Key.isDown(Key.UP)){
this._y -= 10;
}else if (Key.isDown(Key.DOWN)){
this._y += 10;
}
for (i = 1; i < 3; i++)
{
var baddguy = _root["baddguy" + i];
var deltax = _x - baddguy._x;
var deltay = _y - baddguy._y;
var radiusp = _width / 2;
var radiusbddg1 = baddguy._width / 2;
if((deltax * deltax) + (deltay * deltay) <= ((radiusp + radiusbddg1) * (radiusp + radiusbddg1)))
{
gotoAndStop(2);
}
}
}

includes the code for movement, but it's on the same movie clip so hell, why not. any help?


Comments

Might want to ask that on the BBS...

i did, no one seems to have much of anything though, so i posted it here too on the offhand chance anyone can help.

is that supposed to be a distance formula?
Math.sqrt(deltaX^2+deltaY^2)

thanks.