C++ 如何在每个动画中保留一个投射物?

C++ 如何在每个动画中保留一个投射物?,c++,C++,我的问题是这样的: if (rect.left = 512 (where the arrow is released)) arrow.setPosition...; arrowArray.push_back(arrow); for (this->i = 0; this->i < arrowArray.size(); this->i++) { wowvelo.x -= 2 * dt; assume the arrow is moving to the left ar

我的问题是这样的:

if (rect.left = 512 (where the arrow is released))

arrow.setPosition...;

arrowArray.push_back(arrow);

for (this->i = 0; this->i < arrowArray.size(); this->i++) {

wowvelo.x -= 2 * dt; assume the arrow is moving to the left
arrowArray[i].Move(wowvelo);

    arrowArray[this->i].draw(window);   

}
每当角色在拍摄时,他都会在每个动画循环中拍摄超过1个(15个投射物)

我将其编程如下:

if (rect.left = 512 (where the arrow is released))

arrow.setPosition...;

arrowArray.push_back(arrow);

for (this->i = 0; this->i < arrowArray.size(); this->i++) {

wowvelo.x -= 2 * dt; assume the arrow is moving to the left
arrowArray[i].Move(wowvelo);

    arrowArray[this->i].draw(window);   

}
if(rect.left=512(箭头被释放的位置))
箭头。设置位置。。。;
箭头阵列。向后推(箭头);
对于(this->i=0;this->ii++){
wowvelo.x-=2*dt;假设箭头向左移动
arrowArray[i].移动(wowvelo);
箭头数组[this->i]。绘制(窗口);
}

我们能看到调用此块的代码吗?看起来上面的块只是每帧调用15次。另外:如果(rect.left==512),您可能需要
if(rect.left==512)
<代码>=为assignment@Jeffrey是的,我的程序中有“==”,只是写错了。事实上,我不能“我”它在动画中被调用15次。我不明白你是凭什么知道的。如果rect.left为512,则for循环开始,而另一个代码则不是relevant@Jeffrey请问您在哪里知道每帧调用15次?