Gleeok
04-10-2008, 02:20 AM
In the past i've been using this code to fire ffc projectiles directly at Link. Since Angular doesn't rely on Vx and Vy I'm having to rethink some of the code so it works with eweapons.
I'm having trouble finding a formula that would convert x,y to angles, or even rewriting it completely and would appreciate some help.
int dx = Link->X - this->X;
int dy = Link->Y - this->Y;
float norm = Sqrt(dx*dx+dy*dy);
if(norm > 0)
{
shuriken1->Vx = dx/norm*speed;
shuriken1->Vy = dy/norm*speed;
}
And...What I've been using for angles:
eweapon->Angle = deg*(PI/180);
Edit: Aaaahh! I think I just broke my brain. :( Any chance in posted the built in zc fireball code?
I'm having trouble finding a formula that would convert x,y to angles, or even rewriting it completely and would appreciate some help.
int dx = Link->X - this->X;
int dy = Link->Y - this->Y;
float norm = Sqrt(dx*dx+dy*dy);
if(norm > 0)
{
shuriken1->Vx = dx/norm*speed;
shuriken1->Vy = dy/norm*speed;
}
And...What I've been using for angles:
eweapon->Angle = deg*(PI/180);
Edit: Aaaahh! I think I just broke my brain. :( Any chance in posted the built in zc fireball code?