本文整理汇总了C++中Lixxie::is_last_frame方法的典型用法代码示例。如果您正苦于以下问题:C++ Lixxie::is_last_frame方法的具体用法?C++ Lixxie::is_last_frame怎么用?C++ Lixxie::is_last_frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lixxie
的用法示例。
在下文中一共展示了Lixxie::is_last_frame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_shrugger
void update_shrugger(Lixxie& l, const UpdateArgs& ua)
{
ua.suppress_unused_variable_warning();
if (l.is_last_frame()) l.become(LixEn::WALKER);
else l.next_frame();
}
示例2: update_splatter
void update_splatter(Lixxie& l, const UpdateArgs& ua)
{
ua.suppress_unused_variable_warning();
if (l.is_last_frame()) l.become(LixEn::NOTHING);
else l.next_frame();
}
示例3: update_ascender
void update_ascender(Lixxie& l, const UpdateArgs& ua)
{
ua.suppress_unused_variable_warning();
// normally, move up once, but not on the last frame
if (l.get_frame() != 5) l.move_up();
if (l.is_last_frame()) l.become(LixEn::WALKER);
else l.next_frame();
}
示例4: update_exiter
void update_exiter(Lixxie& l, const UpdateArgs& ua)
{
ua.suppress_unused_variable_warning();
int x = l.get_special_x();
if (x < 0) {
l.set_x(l.get_x() + 1);
++x;
}
else if (x > 0 && x < 1000) {
l.set_x(l.get_x() - 1);
--x;
}
l.set_special_x(x);
if (!l.is_last_frame()) l.next_frame();
else l.set_special_x(1000);
}
示例5: update_faller
void update_faller(Lixxie& l, const UpdateArgs& ua)
{
for (int i = 0; i <= l.get_special_y() && l.get_ac() == LixEn::FALLER;++i){
// a bit kludgy, we can't do such a thing for flingers etc, since
// they might be nonconstant.
if (l.get_foot_encounters() & Lookup::bit_trampoline) {
// stop falling, so the trampoline can be used
break;
}
else if (l.is_solid(0, i+2)) {
l.move_down(i);
l.set_special_x(l.get_special_x() + i);
// Schirm in letzter Sekunde?
if (l.get_special_x() > Lixxie::distance_safe_fall
&& !l.get_floater()) {
l.become(LixEn::SPLATTER);
l.play_sound(ua, Sound::SPLAT);
// Nicht explodieren lassen, das täte er bei 76 :-)
if (l.get_updates_since_bomb() == 75)
l.set_updates_since_bomb(0);
}
else if ((l.get_special_x() <= 9 && l.get_frame() < 1)
|| l.get_special_x() == 0) {
l.become(LixEn::WALKER);
if (l.get_runner()) l.set_frame(6);
else l.set_frame(8);
}
else if (l.get_frame() < 2) {
l.become(LixEn::WALKER);
l.set_frame(0);
}
else if (l.get_frame() < 3) {
l.become(LixEn::LANDER);
l.set_frame(1);
}
else {
l.become(LixEn::LANDER);
// use the regular frame 0
}
}
}
if (l.get_ac() == LixEn::FALLER) {
l.set_special_x(l.get_special_x() + l.get_special_y());
l.move_down(l.get_special_y());
if (l.get_special_y() < 8) l.set_special_y(l.get_special_y() + 1);
// The last two frames alternate, the first frames are just the
// initial frames of falling.
if (l.is_last_frame()) l.set_frame(l.get_frame() - 1);
else l.next_frame();
if (l.get_floater()
&& l.get_special_x() >= Lixxie::distance_float) {
const int sy = l.get_special_y();
l.become(LixEn::FLOATER);
l.set_special_y(sy);
}
}
}
示例6: update_platformer
void update_platformer(Lixxie& l, const UpdateArgs& ua)
{
// Der Platformer hat zwei Zyklen. Im ersten Zyklus baut der den
// Stein oberhalb der Laufhoehe, im allen nachfolgenden Zyklen weiter
// unten.
switch (l.get_frame()) {
// Bauen
case 1:
case 17:
l.set_special_x(l.get_special_x() - 1);
if (l.get_frame() == 1) l.draw_brick(0, 0, 7, 1);
else l.draw_brick(4, 2, 9, 3);
if (l.get_special_x() < 3 && l.get_queue() <= 0)
l.play_sound_if_trlo(ua, Sound::BRICK);
break;
case 4:
// Sinnvolle Steinverlegung wie bei Frame 25 pruefen:
// Kompletten naechsen Stein vorausplanen, bei Kollision NICHT drehen.
if (platformer_is_solid(l, 6, -1)
&& platformer_is_solid(l, 8, -1) && platformer_is_solid(l, 10, -1)) {
l.become(LixEn::WALKER);
}
break;
case 6:
if (! l.is_solid(0, -2)) l.move_up();
else {
l.become(LixEn::SHRUGGER2);
l.set_frame(platformer_standing_up_frame);
}
// faellt durch
case 7:
case 21:
case 22:
case 23:
// 2, 1 statt 2, 0, weil wir direkt ueber dem Boden pruefen wollen,
// ob da ein Pixel ist. Sonst laufen die Walker durch.
if (! platformer_is_solid(l, 2, 1)) l.move_ahead();
else {
l.become(LixEn::SHRUGGER2);
l.set_frame(platformer_standing_up_frame);
}
break;
case 25: // durchaus auch das letzte Frame
// Kann noch ein Stein verlegt werden?
if (l.get_special_x() <= 0) {
if (l.get_queue() <= 0) {
l.become(LixEn::SHRUGGER2);
l.set_special_y(2); // Bei Klick 2 tiefer anfng. = weiterbauen
}
else {
l.set_queue (l.get_queue() - 1);
l.set_special_x(l.get_special_x() + 12);
}
}
else if (platformer_is_solid(l, 2, 1)
&& platformer_is_solid(l, 4, 1)
&& platformer_is_solid(l, 6, 1)) {
l.become(LixEn::SHRUGGER2);
l.set_frame(platformer_standing_up_frame);
}
break;
}
if (l.get_ac() == LixEn::PLATFORMER) {
if (l.is_last_frame()) l.set_frame(10);
else l.next_frame();
}
}
示例7: update_jumper
//.........这里部分代码省略.........
// Die groessere Laenge wird pixelweise abgearbeitet.
for (unsigned i = 0; i < (abs >= spe ? abs : spe); ++i) {
// 2 * (... / 2) sorgt fuer das Einhalten der geraden X-Zahlen.
// Es wird jeweils geguckt, ob der Zaehler i weit genug vor-
// geschritten ist, damit in die kurze Richtung ein
// Schritt stattfinden kann - wenn nicht, ist das Argument
// von move_ahead stets 0. In die lange Richtung geht's immer.
const int old_ex = l.get_ex();
const int old_ey = l.get_ey();
const Lookup::LoNr old_enc_foot = l.get_foot_encounters();
const Lookup::LoNr old_enc_body = l.get_body_encounters();
if (abs >= spe) {
l.move_ahead(2 * ((i+1)*spe/2 / abs - i*spe/2 / abs));
l.move_down(sgn);
}
else {
l.move_down(sgn * ((i+1)*abs/spe - i*abs/spe));
l.move_ahead(i%2 * 2);
}
int coll = jumper_and_tumbler_collision(l);
if (coll == 0) {
// nothing hit, proceed with next step for this frame
}
else if (coll == 1) {
// we hit something, but don't have to reset anything. Stop motion.
break;
}
else if (coll == 2) {
// We hit something, reset encounters and check again at position.
l.set_foot_encounters(old_enc_foot);
l.set_body_encounters(old_enc_body);
l.set_ey(l.get_ey()); // re-check encounters at current position
break;
}
else if (coll == 3) {
// Like coll == 2, but also reset position.
l.set_foot_encounters(old_enc_foot);
l.set_body_encounters(old_enc_body);
l.set_ex(old_ex);
l.set_ey(old_ey);
// Do this for completely immobilizied tumblers
if (l.is_solid(0, 0)) l.become(LixEn::STUNNER);
break;
}
// end checking return val of collision
}
// end of motion
// Wenn nicht beim Bewegen irgendwo angestossen...
if (l.get_ac() == LixEn::JUMPER
|| l.get_ac() == LixEn::TUMBLER) {
const int sp_y = l.get_special_y();
if (sp_y <= 12) l.set_special_y(sp_y + 2);
else if (sp_y < 64) l.set_special_y(sp_y + 1);
if (l.get_ac() == LixEn::TUMBLER
&& (l.get_foot_encounters() & Lookup::bit_trampoline)
&& l.get_special_y() > 0) {
// don't use the tumbler frame selection that is used onwards here,
// but take a nicer frame
l.set_frame(std::max(0, l.get_frame() - 4));
}
else if (l.get_special_y() > 14) {
if (l.get_floater()) {
const int sx = l.get_special_x();
const int sy = l.get_special_y();
l.become(LixEn::FLOATER);
l.set_special_x(sx);
l.set_special_y(sy);
}
else if (l.get_ac() == LixEn::JUMPER) {
l.set_ac(LixEn::TUMBLER);
l.set_frame(3); // override autoframechoice for 1 frame now
}
else { // we're already a tumbler
tumbler_frame_selection(l);
}
}
else if (l.get_ac() == LixEn::TUMBLER) {
tumbler_frame_selection(l);
}
else {
// we are a jumper
if (l.is_last_frame()) {
if (l.get_runner()) l.set_frame(12);
else l.set_frame(l.get_frame() - 1);
}
else l.next_frame();
}
}
switch (l.get_ac()) {
case LixEn::STUNNER: l.play_sound(ua, Sound::OUCH); break;
case LixEn::SPLATTER: l.play_sound(ua, Sound::SPLAT); break;
case LixEn::CLIMBER: l.play_sound(ua, Sound::CLIMBER); break;
default: break;
}
}