本文整理汇总了C++中Assignment::setImage方法的典型用法代码示例。如果您正苦于以下问题:C++ Assignment::setImage方法的具体用法?C++ Assignment::setImage怎么用?C++ Assignment::setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assignment
的用法示例。
在下文中一共展示了Assignment::setImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: studentAction
void TDefense::studentAction()
{
QPoint *myTarget = myStudent->getTarget();
studentShoot(myTarget);
for (int i = 0; i < myStudentBullets.size(); i++)
{
Bullet *curBullet = myStudentBullets[i];
double bX = curBullet->getX();
double bY = curBullet->getY();
double bVX = curBullet->getVX();
double bVY = curBullet->getVY();
int bHeight = curBullet->getImage().height();
int bWidth = curBullet->getImage().width();
curBullet->move();
curBullet->setVX(bVX);
curBullet->setVY(bVY);
for (int j = 0; j < myProblems.size(); j++)
{
Problem *secondProblem = myProblems[j];
if (curBullet->intersects(secondProblem))
{
secondProblem->health--;
if (secondProblem->health == 0)
{
funds += 10;
myProblems.remove(j);
numEnemiesShot++;
}
studentShotFired = false;
studentBulletAdded = false;
}
else if ((bY <= 0 && bVY < 0) || (bX <= 0 && bVX < 0 || (gpHeight <= (bY + bHeight)) && bY > 0 && bVY > 0) || ((gpWidth == (bX + bWidth)) && bVX > 0 && bVX > 0))
{
studentShotFired = false;
studentBulletAdded = false;
} // end else if
if (!studentShotFired && myStudentBullets.size() > 0)
{
myStudentBullets.remove(i);
} // end if
} // end inner for
for (int j = 0; j < myAssignments.size(); j++)
{
Assignment *secondAssignment = myAssignments[j];
if (curBullet->intersects(secondAssignment))
{
secondAssignment->health--;
secondAssignment->setImage(assignment2);
if (secondAssignment->health == 0)
{
funds += 20;
myAssignments.remove(j);
numEnemiesShot++;
}
studentShotFired = false;
studentBulletAdded = false;
}
else if ((bY <= 0 && bVY < 0) || (bX <= 0 && bVX < 0 || (gpHeight <= (bY + bHeight)) && bY > 0 && bVY > 0) || ((gpWidth == (bX + bWidth)) && bVX > 0 && bVX > 0))
{
studentShotFired = false;
studentBulletAdded = false;
} // end else if
if (!studentShotFired && myStudentBullets.size() > 0)
{
myStudentBullets.remove(i);
} // end if
} // end inner for
for (int j = 0; j < myPapers.size(); j++)
{
Paper *secondPaper = myPapers[j];
if (curBullet->intersects(secondPaper))
{
secondPaper->health--;
switch (secondPaper->health)
{
case 4:
secondPaper->setImage(paper2);
break;
case 3:
secondPaper->setImage(paper3);
break;
case 2:
secondPaper->setImage(paper4);
break;
case 1:
secondPaper->setImage(paper5);
break;
}
if (secondPaper->health == 0)
{
funds += 40;
myPapers.remove(j);
numEnemiesShot++;
}
studentShotFired = false;
//.........这里部分代码省略.........