本文整理汇总了C++中Lixxie类的典型用法代码示例。如果您正苦于以下问题:C++ Lixxie类的具体用法?C++ Lixxie怎么用?C++ Lixxie使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lixxie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assclk_platformer
void assclk_platformer(Lixxie& l)
{
if (l.get_ac() == LixEn::PLATFORMER) {
l.set_queue(l.get_queue() + 1);
}
else l.become(LixEn::PLATFORMER);
}
示例2: assclk_builder
void assclk_builder(Lixxie& l)
{
if (l.get_ac() == LixEn::BUILDER) {
l.set_queue(l.get_queue() + 1);
}
else l.become(LixEn::BUILDER);
}
示例3: 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();
}
示例4: 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();
}
示例5: update_drowner
void update_drowner(Lixxie& l, const UpdateArgs& ua)
{
// Make it look more nicely
// if (!l.is_solid(0, 6)) l.move_down(1);
if (l.get_frame() < drowner_steep_frame && !l.is_solid(8, 0))
l.move_ahead();
update_splatter(l, ua);
}
示例6: update_burner
void update_burner(Lixxie& l, const UpdateArgs& ua)
{
// Nach unten bewegen, wenn kein Boden da ist und wir die Animation
// noch nicht zu weit abgeschritten haben
for (int i = 0; i < 5 - l.get_frame(); ++i)
if (!l.is_solid()) l.move_down(1);
update_splatter(l, ua);
}
示例7: become_drowner
void become_drowner(Lixxie& l)
{
int drowner_frame = 0;
if (l.get_ac() == LixEn::TUMBLER
&& l.get_frame() > tumbler_frame_steep_drown) {
drowner_frame = drowner_steep_frame;
}
l.become_default(LixEn::DROWNER);
l.set_frame(drowner_frame);
}
示例8: become_platformer
void become_platformer(Lixxie& l)
{
const bool continue_on_same_height
= (l.get_ac() == LixEn::SHRUGGER2
&& l.get_frame() < platformer_standing_up_frame);
l.become_default(LixEn::PLATFORMER);
l.set_special_x(12);
l.set_frame(continue_on_same_height ? 16 : 0);
}
示例9: 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();
}
示例10: become_ascender
void become_ascender(Lixxie& l)
{
l.become_default(LixEn::ASCENDER);
// determine the height to step up. Seek a floor pixel with air above it.
int swh = 0;
while (swh < 26 && ! (l.is_solid(0, 2 - swh) && ! l.is_solid(0, 1 - swh)))
++swh;
int frame = 5; // this is the last frame
switch (swh) {
case 0: case 1:
case 2: case 3: frame = 5; break;
case 4: case 5: frame = 4; break;
case 6: case 7: frame = 3; break;
case 8: case 9: frame = 2; break;
case 10: case 11: frame = 1; break;
default: frame = 0; break;
}
int swh_wanted = 10 - frame * 2;
l.set_frame(frame);
// Move up, [check for even cliff,] move down again
l.move_up(swh);
// This was in earlier versions to look good, but the community frowned
// on it for inconsistency; and sometimes the skipped x-pixels have indeed
// yielded problems.
// if (! l.is_solid(2, 0) && ! l.is_solid(2, 1)) l.move_ahead();
l.move_down(swh_wanted);
}
示例11: 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);
}
示例12: become_jumper
void become_jumper(Lixxie& l)
{
l.become_default(LixEn::JUMPER);
if (l.get_runner()) {
l.set_special_x( 8); // X-speed
l.set_special_y(-12); // Y-speed
l.set_frame(12);
}
else {
l.set_special_x( 6); // X-speed
l.set_special_y(-8); // Y-speed
}
for (int i = -4; i > -16; --i)
if (l.is_solid(0, i)) {
l.become(LixEn::STUNNER);
return;
}
}
示例13: platformer_is_solid
static bool platformer_is_solid(Lixxie& l, int x, int y)
{
// If the pixel is solid, return false nontheless if there is free air
// over the pixel
bool b = l.is_solid(x, y);
if (b && l.is_solid(x + 2, y) && l.is_solid(x + 4, y)) return true;
for (int i = 0; i > -3; --i)
b = b && (l.is_solid(x+2, y-2)
|| l.is_solid(x, y-2)
|| l.is_solid(x-2, y-2));
return b;
}
示例14: set_frame_after_aiming
// Hilfsfunktion
void set_frame_after_aiming(Lixxie& l, const UpdateArgs& ua)
{
const double pi = std::acos(-1.0);
const int x = (ua.aim_x - l.get_ex()) * l.get_dir();
const int y = ua.aim_y - l.get_ey();
// Fuer (0, 0) einfach nix machen, Lix soll wie vorher schauen
if (x != 0 || y != 0) {
// Den Winkel so ausrechnen, als sei (0, 1) der Nullwinkel,
// nicht (1, 0), wie es normal waere. Alles gedreht.
// atan2 nimmt die Dinger in der Reihenfolge 1. y, 2. x.
double angle = std::atan2(-x, -y) * 180 / pi;
if (angle > 99) l.set_frame(frame_aiming_first + 0);
else if (angle > 80) l.set_frame(frame_aiming_first + 1);
else if (angle > 60) l.set_frame(frame_aiming_first + 2);
else if (angle > 30) l.set_frame(frame_aiming_first + 3);
else if (angle > 10) l.set_frame(frame_aiming_first + 4);
else if (angle > -10) l.set_frame(frame_aiming_first + 5);
else if (angle > -30) l.set_frame(frame_aiming_first + 6);
else if (angle > -60) l.set_frame(frame_aiming_first + 7);
else if (angle > -80) l.set_frame(frame_aiming_first + 8);
else if (angle > -99) l.set_frame(frame_aiming_first + 9);
else l.set_frame(frame_aiming_first + 10);
}
}
示例15: update_roper
void update_roper(Lixxie& l, const UpdateArgs& ua)
{
// Normales Update, einmal pro Tick
if (!ua.aim_c) {
if (l.get_frame() < frame_aiming_first) {
l.next_frame();
}
// Nagel fertig in der Erde, aber vor Haken abschiessen
else if (l.get_special_x() == 0) {
set_frame_after_aiming(l, ua);
// Wenn man zu lange wartet, weiterlaufen, einfach
l.set_special_y(l.get_special_y() + 1);
if (l.get_special_y() > Lixxie::updates_roper_before)
l.become(LixEn::WALKER);
}
// Haken wurde schon abgeschossen, warten, ehe man weiterlaeuft
else {
l.set_special_y(l.get_special_y() + 1);
if (l.get_special_y() > Lixxie::updates_roper_after)
l.become(LixEn::WALKER);
}
}
// Zusaetzliches Update pro Tick, wenn zum Zielen per Klick aufgefordert
// wurde: Dies wird vor dem normalen Update ausgefuehrt.
else {
// Nagel in den Boden hauen: Zwar Maus in Beschlag nehmen durch
// special_x == 0, aber nix machen. Weiter die Klicks aufsaugen.
if (l.get_frame() < frame_aiming_first);
// Zielen, aber noch nicht abgeschossen: Nun abschiessen
else if (l.get_special_x() == 0) {
l.set_special_x(1);
l.set_special_y(0);
set_frame_after_aiming(l, ua);
}
}
}