当前位置: 首页>>代码示例>>C++>>正文


C++ Part::addFrame方法代码示例

本文整理汇总了C++中Part::addFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Part::addFrame方法的具体用法?C++ Part::addFrame怎么用?C++ Part::addFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Part的用法示例。


在下文中一共展示了Part::addFrame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: construct_Player

Entity construct_Player(int x, int y, int orientation) {
  Entity player = construct_Entity(x, y, orientation);
  player.update = &Player_update;
  
  Part torso = construct_Part();
  torso.addFrame(&torso, "north_idle", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "east_idle", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "south_idle", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "west_idle", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "north_swing_0", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "north_swing_1", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "north_swing_2", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "east_swing_0", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "east_swing_1", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "east_swing_2", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "south_swing_0", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "south_swing_1", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "south_swing_2", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "west_swing_0", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "west_swing_1", 2, 2, '@', WHITE);
  torso.addFrame(&torso, "west_swing_2", 2, 2, '@', WHITE);

  Part front = construct_Part();
  front.isSolid = false;
  front.addFrame(&front, "north_idle", 2, 1, '^', WHITE);
  front.addFrame(&front, "east_idle", 3, 2, '>', WHITE);
  front.addFrame(&front, "south_idle", 2, 3, 'v', WHITE);
  front.addFrame(&front, "west_idle", 1, 2, '<', WHITE);

  Part sword_part_1 = construct_Part();
  sword_part_1.isWeapon = true;
  sword_part_1.isSolid = false;
  sword_part_1.addFrame(&sword_part_1, "north_swing_0", 1, 1, '\\',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "north_swing_1", 2, 1, '|',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "north_swing_2", 3, 1, '/',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "east_swing_0", 3, 1, '/',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "east_swing_1", 3, 2, '-',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "east_swing_2", 3, 3, '\\',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "south_swing_0", 3, 3, '\\',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "south_swing_1", 2, 3, '|',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "south_swing_2", 1, 3, '/',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "west_swing_0", 1, 3, '/',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "west_swing_1", 1, 2, '-',
                        WHITE);
  sword_part_1.addFrame(&sword_part_1, "west_swing_2", 1, 1, '\\',
                        WHITE);

  Part sword_part_2 = construct_Part();
  sword_part_2.isWeapon = true;
  sword_part_2.isSolid = false;
  sword_part_2.addFrame(&sword_part_2, "north_swing_1", 2, 0, '.',
                        WHITE);
  sword_part_2.addFrame(&sword_part_2, "east_swing_1", 4, 2, '-',
                        WHITE);
  sword_part_2.addFrame(&sword_part_2, "south_swing_1", 2, 4, '`',
                        WHITE);
  sword_part_2.addFrame(&sword_part_2, "west_swing_1", 0, 2, '-',
                        WHITE);

  player.addPart(&player, torso);
  player.addPart(&player, front);
  player.addPart(&player, sword_part_1);
  player.addPart(&player, sword_part_2);

  strcpy(player.currentFrame, "north_idle");

  return player;
}
开发者ID:RylandAlmanza,项目名称:clobbit,代码行数:78,代码来源:player.c


注:本文中的Part::addFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。