本文整理汇总了C++中Physics::getfht方法的典型用法代码示例。如果您正苦于以下问题:C++ Physics::getfht方法的具体用法?C++ Physics::getfht怎么用?C++ Physics::getfht使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Physics
的用法示例。
在下文中一共展示了Physics::getfht方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
//.........这里部分代码省略.........
opacity += 0.025f;
if (opacity.last() > 0.975f)
{
opacity.set(1.0f);
fadein = false;
}
}
if (dead)
{
active = false;
return -1;
}
effects.update();
showhp.update();
if (!dying)
{
if (!canfly)
{
if (phobj.flagnotset(PhysicsObject::TURNATEDGES))
{
flip = !flip;
phobj.setflag(PhysicsObject::TURNATEDGES);
if (stance == HIT)
setstance(STAND);
}
}
switch (stance)
{
case MOVE:
if (canfly)
{
phobj.hforce = flip ? flyspeed : -flyspeed;
switch (flydirection)
{
case UPWARDS:
phobj.vforce = -flyspeed;
break;
case DOWNWARDS:
phobj.vforce = flyspeed;
break;
}
}
else
{
phobj.hforce = flip ? speed : -speed;
}
break;
case HIT:
if (canmove)
{
double KBFORCE = phobj.onground ? 0.2 : 0.1;
phobj.hforce = flip ? -KBFORCE : KBFORCE;
}
break;
case JUMP:
phobj.vforce = -5.0;
break;
}
physics.moveobject(phobj);
if (control)
{
counter++;
bool next;
switch (stance)
{
case HIT:
next = counter > 200;
break;
case JUMP:
next = phobj.onground;
break;
default:
next = aniend && counter > 200;
break;
}
if (next)
{
nextmove();
updatemovement();
counter = 0;
}
}
}
else
{
phobj.normalize();
physics.getfht().updatefh(phobj);
}
return phobj.fhlayer;
}
示例2: update
//.........这里部分代码省略.........
if (single.delay <= Constants::TIMESTEP)
{
applysingle(single);
return true;
}
else
{
single.delay -= Constants::TIMESTEP;
return false;
}
});
bool nosingle = singlelist.size() == 0;
size_t remove = 0;
for (auto& dmg : damagenumbers)
{
if (dmg.update())
remove++;
}
for (size_t i = remove; i--;)
{
damagenumbers.erase(damagenumbers.begin());
}
bool nonumbers = damagenumbers.size() == 0;
if (dead && nobullets && nosingle && nonumbers)
{
active = false;
return -1;
}
effects.update();
showhp.update();
if (control && !dying)
{
if (!canfly)
{
if (phobj.flagnotset(PhysicsObject::TURNATEDGES))
{
flip = !flip;
phobj.setflag(PhysicsObject::TURNATEDGES);
if (stance == HIT)
setstance(STAND);
}
}
switch (stance)
{
case MOVE:
if (canfly)
{
phobj.hforce = flip ? flyspeed : -flyspeed;
switch (flydirection)
{
case UPWARDS:
phobj.vforce = -flyspeed;
break;
case DOWNWARDS:
phobj.vforce = flyspeed;
break;
}
}
else
{
phobj.hforce = flip ? speed : -speed;
if (canjump && phobj.onground && counter > 50 && counter < 150 && randomizer.below(0.005f))
{
phobj.vforce = -5.0f;
}
}
break;
case HIT:
if (canmove)
{
double KBFORCE = phobj.onground ? 0.2 : 0.1;
phobj.hforce = flip ? -KBFORCE : KBFORCE;
}
break;
}
counter++;
if (aniend && counter > 200)
{
nextmove();
sendmovement();
counter = 0;
}
physics.moveobject(phobj);
}
else
{
phobj.normalize();
physics.getfht().updatefh(phobj);
}
return phobj.fhlayer;
}