I'm having a problem with an FFC that allows for throwing objects. The code works if Link throws his object left or right. The object travels until it hits the ground, which is faked by using the Y axis. However if the object is thrown up or down it will speed off at the speed of Light to oblivion and I can't figure out why.
FFC snip-it that handles thrown objects.
//Throw Game->PlaySound(LL_SFX_THROW); direction = Link->Dir; lockY = Link->Y; if(!bomb) { for(frames = 0; frames < 28; frames++) //31 { if(direction == DIR_UP) this->Y -= 3; else if(direction == DIR_DOWN) this->Y += 3; else if(direction == DIR_LEFT) { this->X -= 3; if(this->Y < lockY) this->Y = this->Y+(0.02*1.4*Pow(frames, 2)); } else if(direction == DIR_RIGHT) { this->X += 3; if(this->Y < lockY) this->Y = this->Y+(0.02*1.4*Pow(frames, 2)); } if((this->Y >= lockY && (direction != DIR_DOWN || direction != DIR_UP)) || frames >= 27) break; //Draw object. Screen->DrawCombo(3, this->X, this->Y, combo, this->TileWidth, this->TileHeight, cset, -1, -1, 0, 0, 0, 1, 0, true, OP_OPAQUE); if(this->TileWidth >= 2 && this->TileHeight >= 2) Screen->DrawCombo(3, this->X, this->Y, LL_SHADOW_LARGE, this->TileWidth, this->TileHeight, 11, -1, -1, 0, 0, 0, 1, 0, true, OP_TRANS); if(frames < 15) WaitNoAction(); } //Create LWeapon for object. Game->PlaySound(SFX_POTBREAK); object = CreateLWeaponAt(LW_ARROW, this->X, this->Y); object->Damage = 2; object->DeadState = 10; }