我尝试将粒子图像移动到玩家将在屏幕上单击的位置。我使用物理学中的这个公式来计算速度矢量。
float x = iceBallParticle[i]->GetCurrentLocation().x - iceBallParticle[i]>GetGoToX() ;
float y = iceBallParticle[i]->GetCurrentLocation().y - iceBallParticle[i]->GetGoToY() ;
float c = (x/y);
float alpha = atan(c);
//calculate the velocity x,y
float yVel = (speedOfMoveSkill * cos(alpha)) ;
float xVel = (speedOfMoveSkill * sin(alpha)) ;
//Move Left
if(iceBallParticle[i]->GetCurrentLocation().x > iceBallParticle[i]->GetGoToX())
//move the object
iceBallParticle[i]->SetCurrentLocation(iceBallParticle[i]->GetCurrentLocation().x - xVel , iceBallParticle[i]->GetCurrentLocation().y);
. . . more moves direction down here.
GoTo 是玩家单击的位置,当前位置是粒子发射的位置。我认为问题是因为他用 int 打印图像,当我发送它打印时,他错过了点 x.xxxx 之后的数字
_______
/
/
他上去然后直奔,我要他直奔主题
/
/
/
我该如何解决?