本文整理汇总了C++中soundLib类的典型用法代码示例。如果您正苦于以下问题:C++ soundLib类的具体用法?C++ soundLib怎么用?C++ soundLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了soundLib类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: play_music
void sceneShow::play_music(int n)
{
if (playmusic_list.size() <= n) {
std::cout << "ERROR: Scene PlayMusic[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
exit(-1);
}
soundManager.stop_music();
soundManager.load_music(playmusic_list.at(n).filename);
soundManager.play_music();
}
开发者ID:eduardok,项目名称:rockbot,代码行数:10,代码来源:sceneshow.cpp
示例2: get_item
bool classPlayer::get_item(object_colision &obj_info)
{
if (character::get_item(obj_info)) {
return true;
}
bool res = false;
// deal with non-blocking items
if (obj_info._object != NULL && obj_info._object->finished() == false) {
//std::cout << "classPlayer::get_item" << std::endl;
switch (obj_info._object->get_type()) {
case OBJ_ENERGY_TANK:
if (game_save.items.energy_tanks < 9) {
game_save.items.energy_tanks++;
}
obj_info._object->set_finished(true);
soundManager.play_sfx(SFX_GOT_ITEM);
res = true;
break;
case OBJ_WEAPON_TANK:
if (game_save.items.weapon_tanks == 0) {
game_save.items.weapon_tanks++;
}
obj_info._object->set_finished(true);
soundManager.play_sfx(SFX_GOT_ITEM);
res = true;
break;
case OBJ_LIFE:
game_save.items.lifes++;
if (game_save.items.lifes > 9) {
game_save.items.lifes = 9;
}
obj_info._object->set_finished(true);
soundManager.play_sfx(SFX_GOT_ITEM);
res = true;
break;
case OBJ_WEAPON_PILL_BIG:
obj_info._object->set_finished(true);
recharge(ENERGY_TYPE_WEAPON, ENERGY_ITEM_BIG);
res = true;
break;
case OBJ_WEAPON_PILL_SMALL:
obj_info._object->set_finished(true);
recharge(ENERGY_TYPE_WEAPON, ENERGY_ITEM_SMALL);
res = true;
break;
default:
//std::cout << "classPlayer::get_item - unknown item type: " << obj_info._object->get_type() << std::endl;
break;
}
}
return res;
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:53,代码来源:classplayer.cpp
示例3: show_scene
void sceneShow::show_scene(int n)
{
if (n < 0) {
return;
}
if (scene_list.size() <= n) {
std::cout << "ERROR: Scene List[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
return;
}
CURRENT_FILE_FORMAT::file_scene_list scene = scene_list.at(n);
input.clean();
for (int i=0; i<SCENE_OBJECTS_N; i++) {
input.read_input();
int scene_seek_n = scene.objects[i].seek_n;
//std::cout << ">> sceneShow::show_scene - i: " << i << ", scene_seek_n: " << scene_seek_n << std::endl;
if (_interrupt_scene == true || input.p1_input[BTN_START] == 1) {
scene_seek_n = -1;
break;
}
if (scene_seek_n != -1) {
int scene_type = scene.objects[i].type;
//std::cout << "### scene_type[" << scene_type << "]" << std::endl;
if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_TEXT) {
show_text(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_AREA) {
clear_area(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_SCREEN) {
graphLib.clear_area(0 ,0, RES_W, RES_H, 0, 0, 0);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_IMAGE) {
show_image(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_VIEWPOINT) {
show_viewpoint(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_MUSIC) {
play_music(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_SFX) {
play_sfx(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_ANIMATION) {
show_animation(scene_seek_n, scene.objects[i].repeat_value, scene.objects[i].repeat_type);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_STOP_MUSIC) {
soundManager.stop_music();
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SUBSCENE) {
show_scene(scene_seek_n);
} else {
std::cout << ">> sceneShow::show_scene - unknown scene_type[" << scene_type << "]" << std::endl;
}
std::cout << "show_scene::DELAY[" << i << "][" << scene.objects[i].delay_after << "]" << std::endl;
if (input.waitScapeTime(scene.objects[i].delay_after) == 1) {
_interrupt_scene = true;
}
} else {
break;
}
}
std::cout << "show_scene::DONE" << std::endl;
}
开发者ID:protoman,项目名称:rockbot,代码行数:58,代码来源:sceneshow.cpp
示例4: recharge
void classPlayer::recharge(e_energy_types _en_type, int value)
{
if (_en_type == ENERGY_TYPE_HP) {
character::recharge(_en_type, value);
} else if (_en_type == ENERGY_TYPE_WEAPON) {
if (game_save.items.weapons[selected_weapon] < PLAYER_INITIAL_HP) {
if (game_save.items.weapons[selected_weapon] + value <= PLAYER_INITIAL_HP) {
game_save.items.weapons[selected_weapon] += value;
} else {
game_save.items.weapons[selected_weapon] = PLAYER_INITIAL_HP;
}
soundManager.play_sfx(SFX_GOT_ENERGY);
if (value > ENERGY_ITEM_SMALL) {
soundManager.play_sfx(SFX_GOT_ENERGY);
}
}
}
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:18,代码来源:classplayer.cpp
示例5: play_sfx
void sceneShow::play_sfx(int n)
{
if (playsfx_list.size() <= n) {
std::cout << "ERROR: Scene PlaySFX[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
exit(-1);
}
if (playsfx_list.at(n).repeat_times < 1) {
playsfx_list.at(n).repeat_times = 1;
}
soundManager.play_sfx_from_file(playsfx_list.at(n).filename, playsfx_list.at(n).repeat_times);
}
开发者ID:eduardok,项目名称:rockbot,代码行数:11,代码来源:sceneshow.cpp
示例6: main
int main(int argc, char *argv[])
{
get_filepath();
fio.read_game(game_data);
soundManager.init_audio_system();
if (graphLib.initGraphics() != true) {
printf("ERROR intializing graphic\n");
return -1;
}
sceneShow show;
show.show_scene(0);
input.wait_keypress();
return 1;
}
开发者ID:farleyknight,项目名称:rockbot,代码行数:19,代码来源:main.cpp
示例7: reset_charging_shot
void classPlayer::reset_charging_shot()
{
if (selected_weapon != WEAPON_DEFAULT) { // only do this, if using normal weapon
return;
}
state.attack_timer = 0;
attack_button_released = true;
soundManager.stop_repeated_sfx();
if (color_keys[0].r != -1) {
change_char_color(color_keys[0], color_keys[0], true);
}
if (color_keys[1].r != -1) {
change_char_color(color_keys[1], color_keys[1], true);
}
// also reset slide/dash
if (state.animation_type == ANIM_TYPE_SLIDE) {
set_animation_type(ANIM_TYPE_WALK);
state.slide_distance = 0;
}
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:20,代码来源:classplayer.cpp
示例8: teleport_stand
void classPlayer::teleport_stand()
{
unsigned int waitTimer = timer.getTimer()+500;
state.animation_state = ANIM_TYPE_TELEPORT;
/*
if (p2Obj) {
p2Obj->sprite->anim_type = ANIM_TELEPORT;
}
*/
soundManager.play_sfx(SFX_TELEPORT);
while (waitTimer > timer.getTimer()) {
draw_lib.update_screen();
show();
/*
if (p2Obj) {
show_sprite(p2Obj->sprite, game_screen);
}
*/
//drawMap3rdLevel(game_screen);
//updateScreen(game_screen);
input.waitTime(20);
}
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:23,代码来源:classplayer.cpp
示例9: show_scene
void sceneShow::show_scene(int n)
{
if (scene_list.size() <= n) {
std::cout << "ERROR: Scene List[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
exit(-1);
}
CURRENT_FILE_FORMAT::file_scene_list scene = scene_list.at(0);
for (int i=0; i<SCENE_OBJECTS_N; i++) {
int scene_seek_n = scene.objects[i].seek_n;
if (scene_seek_n != -1) {
int scene_type = scene.objects[i].type;
if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_TEXT) {
show_text(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_AREA) {
clear_area(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_SCREEN) {
graphLib.clear_area(0 ,0, RES_W, RES_H, 0, 0, 0);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_IMAGE) {
show_image(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_VIEWPOINT) {
/// @TODO
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_MUSIC) {
play_music(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_SFX) {
play_sfx(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_ANIMATION) {
show_animation(scene_seek_n, scene.objects[i].repeat_value, scene.objects[i].repeat_type);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_STOP_MUSIC) {
soundManager.stop_music();
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SUBSCENE) {
show_scene(scene_seek_n);
}
timer.delay(scene.objects[i].delay_after);
}
}
}
开发者ID:eduardok,项目名称:rockbot,代码行数:36,代码来源:sceneshow.cpp
示例10: draw_screen
void key_map::draw_screen()
{
bool finished = false;
st_position config_text_pos;
st_position cursor_pos;
short _pick_pos = 0;
config_text_pos.x = graphLib.get_config_menu_pos().x + 74;
config_text_pos.y = graphLib.get_config_menu_pos().y + 40;
cursor_pos = config_text_pos;
graphLib.clear_area(config_text_pos.x-1, config_text_pos.y-1, 180, 180, 0, 0, 0);
input.clean();
input.waitTime(300);
for (unsigned int i=0; i<_keys_list.size(); i++) {
graphLib.draw_text(config_text_pos.x, config_text_pos.y + i*CURSOR_SPACING, _keys_list[i].c_str());
redraw_line(i);
}
graphLib.draw_text(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING, "RETURN");
draw_lib.update_screen();
//cout << "scenesLib::option_picker::START\n";
graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
while (finished == false) {
input.readInput();
if (input.p1_input[BTN_START]) {
if (_pick_pos == (short)_keys_list.size()) {
std::cout << "key_map::draw_screen - FINISHED #1" << std::endl;
finished = true;
} else {
graphLib.draw_text(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING+CURSOR_SPACING*2, "PRESS NEW KEY/BUTTON"); //input code (number)
draw_lib.update_screen();
//format_v_2_1_1::st_key_config new_key = input.get_pressed_key();
graphLib.clear_area(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING+CURSOR_SPACING*2-1, 180, CURSOR_SPACING+1, 0, 0, 0);
///@TODO - key_config[_pick_pos].key_type = new_key.key_type;
///@TODO - key_config[_pick_pos].key_number = new_key.key_number;
redraw_line(_pick_pos);
draw_lib.update_screen();
}
}
if (input.p1_input[BTN_DOWN]) {
soundManager.play_sfx(SFX_CURSOR);
graphLib.eraseCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
_pick_pos++;
if (_pick_pos >= (short)_keys_list.size()+1) {
_pick_pos = 0;
}
graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
}
if (input.p1_input[BTN_UP]) {
soundManager.play_sfx(SFX_CURSOR);
graphLib.eraseCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
_pick_pos--;
if (_pick_pos < 0) {
_pick_pos = _keys_list.size();
}
graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
}
if (input.p1_input[BTN_QUIT]) {
std::cout << "key_map::draw_screen - FINISHED #2" << std::endl;
finished = true;
}
input.clean();
input.waitTime(10);
draw_lib.update_screen();
}
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:69,代码来源:key_map.cpp
示例11: move_cursor
// column1: normal, ape, daisie, dynamite, mummy, spike
// column2: techno, mage, seahorse, item coil, item jet
// column3: e-tank, w-tank *(must be changed, as currently are two rows)
void class_config::move_cursor(Sint8 x_inc, Sint8 y_inc) {
// left/right: if position exists, just move. if not then go to first item in nexct column or stays in place
bool moved = false;
st_position res;
//std::cout << ">>>>> class_config::move_cursor - xinc: " << x_inc << ", y_inc: " << y_inc << std::endl;
if (ingame_menu_pos.y != 6) { // weapons positions
if (x_inc > 0) {
if (ingame_menu_pos.x == 0) {
res = move_weapon_curstor_right();
if (res.x != -1) {
ingame_menu_pos = res;
moved = true;
}
} else {
res = move_weapon_curstor_left(); // right on right column - move left
if (res.x != -1) {
ingame_menu_pos = res;
moved = true;
}
}
} else if (x_inc < 0 && ingame_menu_pos.y != 0) {
if (ingame_menu_pos.x == 0) {
res = move_weapon_curstor_right(); // left on left column - move right
if (res.x != -1) {
ingame_menu_pos = res;
moved = true;
}
} else {
res = move_weapon_curstor_left();
if (res.x != -1) {
ingame_menu_pos = res;
moved = true;
}
}
}
} else { // energy drinks position
if (x_inc > 0 && ingame_menu_pos.y != 0) {
if (ingame_menu_pos.x < 2) {
ingame_menu_pos.x++;
} else {
ingame_menu_pos.x = 0;
}
moved = true;
} else if (x_inc < 0) {
if (ingame_menu_pos.x == 0) {
ingame_menu_pos.x = 2;
} else {
ingame_menu_pos.x--;
}
moved = true;
}
}
if (y_inc > 0) {
if (ingame_menu_pos.y < 6) {
res = move_weapon_curstor_down();
if (res.y != -1) {
ingame_menu_pos = res;
moved = true;
}
} else {
ingame_menu_pos.x = 0;
ingame_menu_pos.y = 0;
}
moved = true;
} else if (y_inc < 0) {
if ((ingame_menu_pos.x == 0 && ingame_menu_pos.y == 0) || (ingame_menu_pos.x == 1 && ingame_menu_pos.y == 1)) { // when on top, go to energy drinks section
std::cout << "MOVE CURSOR #1" << std::endl;
ingame_menu_pos.y = 6;
} else {
if (ingame_menu_pos.y == 6 && ingame_menu_pos.x == 2) { // just fix x, as there is no third column on weapons section as there is in the energy drinks section
ingame_menu_pos.x = 1;
}
res = move_weapon_curstor_up();
if (res.y != -1) {
ingame_menu_pos = res;
moved = true;
}
}
}
if (moved == true) {
soundManager.play_sfx(SFX_CURSOR);
}
}
开发者ID:eduardok,项目名称:rockbot,代码行数:94,代码来源:class_config.cpp
示例12: use_tank
void class_config::use_tank(int tank_type)
{
int n = 0;
// check tank number
if (tank_type == TANK_ENERGY && game_save.items.energy_tanks == 0) {
return;
}
if (tank_type == TANK_WEAPON && game_save.items.weapon_tanks == 0) {
return;
}
if (tank_type == TANK_SPECIAL && game_save.items.special_tanks == 0) {
return;
}
// no need for tank usage
if (tank_type == TANK_ENERGY && player_ref->get_hp().current == player_ref->get_hp().total) {
return;
}
if (tank_type == TANK_ENERGY || tank_type == TANK_SPECIAL) {
while (player_ref->get_hp().current < player_ref->get_hp().total) {
player_ref->set_current_hp(1);
if (n == 0 || n % 6 == 0) {
soundManager.play_sfx(SFX_GOT_ENERGY);
}
n++;
//graphLib.draw_horizontal_hp_bar(WPN_COLUMN_Y, 2, player_ref->get_hp().current);
graphLib.draw_weapon_cursor(st_position(0, 0), player_ref->get_hp().current, -1);
draw_lib.update_screen();
input.waitTime(50);
}
}
if (tank_type == TANK_SPECIAL || tank_type == TANK_WEAPON) {
st_position weapon_pos(0, 0);
for (int i=0; i<WEAPON_COUNT; i++) {
n = 0;
short unsigned int value = player_ref->get_weapon_value(i);
if (value < player_ref->get_hp().total) {
while (value < player_ref->get_hp().total) {
value++;
player_ref->set_weapon_value(i, value);
if (n == 0 || n % 6 == 0) {
soundManager.play_sfx(SFX_GOT_ENERGY);
}
n++;
graphLib.draw_weapon_cursor(weapon_pos, player_ref->get_weapon_value(i), -1);
draw_lib.update_screen();
input.waitTime(50);
}
}
weapon_pos.y = weapon_pos.y+1;
if (weapon_pos.y > 5) {
weapon_pos.y = 1;
weapon_pos.x = 1;
}
}
}
// consume tank
if (tank_type == TANK_ENERGY) {
game_save.items.energy_tanks--;
}
if (tank_type == TANK_WEAPON) {
game_save.items.weapon_tanks--;
}
if (tank_type == TANK_SPECIAL) {
game_save.items.special_tanks--;
}
}
开发者ID:eduardok,项目名称:rockbot,代码行数:68,代码来源:class_config.cpp
示例13: main
int main(int argc, char *argv[])
#endif
{
#ifdef PSP
SetupCallbacks();
scePowerSetClockFrequency(333, 333, 166);
#endif
for (int i=0; i<FLAG_COUNT; i++) {
GAME_FLAGS[i] = false;
}
UNUSED(argc);
string argvString = "";
#ifndef WII
argvString = string(argv[0]);
#else
if (!fatInitDefault()) {
printf("fatInitDefault ERROR #1");
std::fflush(stdout);
timer.delay(500);
exit(-1);
}
#endif
get_filepath();
// fallback in case getcwd returns null
if (FILEPATH.size() == 0) {
std::cout << "Could not read path, fallback to using argv" << std::endl;
FILEPATH = argvString.substr(0, argvString.size()-EXEC_NAME.size());
}
std::cout << "main - argvString: '" << argvString << "', FILEPATH: '" << FILEPATH << "'" << std::endl; std::fflush(stdout);
#ifdef PLAYSTATION2
std::cout << "PS2.DEBUG #1" << std::endl; std::fflush(stdout);
#ifndef PS2LINK
SifIopReset(NULL, 0); // clean previous loading of irx by apps like ulaunchElf. Comment this line to get cout on ps2link
#endif
printf("DEBUG.PS2 #1.1\n");
/* SP193: Being creative (Do something while waiting for the slow IOP to be reset). =D */
int main_id = GetThreadId();
ChangeThreadPriority(main_id, 72);
std::cout << "PS2.DEBUG #1.1" << std::endl; std::fflush(stdout);
printf("DEBUG.PS2 #1.2\n");
#ifndef PS2LINK
while(SifIopSync()) {
std::cout << "PS2.SifIopSync()" << std::endl;
}
#endif
/* Initialize and connect to all SIF services on the IOP. */
SifInitRpc(0);
SifInitIopHeap();
SifLoadFileInit();
fioInit();
printf("DEBUG.PS2 #1.3\n");
/* Apply the SBV LMB patch to allow modules to be loaded from a buffer in EE RAM. */
sbv_patch_enable_lmb();
// --- DEBUG --- //
//FILEPATH = "cdfs:/";
// --- DEBUG --- //
std::cout << "PS2.DEBUG #2" << std::endl; std::fflush(stdout);
if (FILEPATH.find("mass:") != std::string::npos) {
printf("DEBUG.PS2 #1.4\n");
std::cout << "PS2.DEBUG Load USB" << std::endl; std::fflush(stdout);
PS2_load_USB();
}
if (FILEPATH.find("cdfs") != std::string::npos || FILEPATH.find("cdrom") != std::string::npos) {
printf("DEBUG.PS2 #1.5\n");
std::cout << "PS2.DEBUG Load CDROM" << std::endl; std::fflush(stdout);
FILEPATH = "cdfs:";
PS2_load_CDROM();
}
printf("DEBUG.PS2 #2\n");
std::cout << "PS2.DEBUG #3" << std::endl; std::fflush(stdout);
#endif
// check command-line paramethers
if (argc > 1) {
for (int i=1; i<argc; i++) {
//.........这里部分代码省略.........
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:101,代码来源:main.cpp
示例14: execute_projectiles
void classPlayer::execute_projectiles()
{
// animate projectiles
vector<projectile>::iterator it;
bool ignore_hit_timer = false;
if (_simultaneous_shots > 1) {
ignore_hit_timer = true;
}
for (it=projectile_list.begin(); it<projectile_list.end(); it++) {
if ((*it).is_finished == true) {
projectile_list.erase(it);
break;
}
st_size moved = (*it).move();
//std::cout << "projectile.move_type: " << (*it)->get_move_type() << std::endl;
/// @TODO projectiles that are tele-guided
if ((*it).get_move_type() == TRAJECTORY_CHAIN) {
(*it).set_y(position.y+frameSize.height/2);
} else if ((*it).get_move_type() == TRAJECTORY_QUAKE) {
damage_ground_npcs();
continue;
}
(*it).draw();
if ((*it).is_reflected == true) {
continue;
}
// check colision agains enemies
std::vector<classnpc*>::iterator enemy_it;
for (enemy_it=map->_npc_list.begin(); enemy_it != map->_npc_list.end(); enemy_it++) {
if ((*it).is_finished == true) {
projectile_list.erase(it);
break;
}
if ((*enemy_it)->is_on_visible_screen() == false) {
continue;
}
if ((*enemy_it)->is_dead() == true) {
continue;
}
//classnpc* enemy = (*enemy_it);
if ((*it).check_colision(st_rectangle((*enemy_it)->getPosition().x, (*enemy_it)->getPosition().y, (*enemy_it)->get_size().width, (*enemy_it)->get_size().height), st_position(moved.width, moved.height)) == true) {
if ((*enemy_it)->is_shielded((*it).get_direction()) == true) { // shielded NPC -> reflects shot
if ((*it).get_trajectory() == TRAJECTORY_CHAIN) {
(*it).consume_projectile();
} else {
(*it).reflect();
}
continue;
}
if ((*enemy_it)->is_invisible() == true) { // invisible NPC -> ignore shot
continue;
}
// check if have hit area, and if hit it
st_rectangle enemy_hit_area = (*enemy_it)->get_hit_area();
st_size enemy_size = (*enemy_it)->get_size();
enemy_hit_area.x += (*enemy_it)->getPosition().x-1;
enemy_hit_area.y += (*enemy_it)->getPosition().y;
//std::cout << ">> PLAYER::execute_projectiles[" << (*enemy_it)->getName() << "] - npc.h: " << enemy_size.height << ", hit_area.h: " << enemy_hit_area.h << std::endl;
if (enemy_hit_area.w != enemy_size.width || enemy_hit_area.h != enemy_size.height) {
//std::cout << ">> PLAYER::execute_projectiles[" << (*enemy_it)->getName() << "] - use hit_area" << std::endl;
if ((*it).check_colision(enemy_hit_area, st_position(moved.width, moved.height)) == false) { // hit body, but not the hit area -> reflect
//std::cout << ">> PLAYER::execute_projectiles[" << (*enemy_it)->getName() << "]Projectile missed - enemy_hit_area.w: " << enemy_hit_area.w << ", enemy_hit_area.h: " << enemy_hit_area.h << std::endl;
(*it).consume_projectile();
continue;
}
//} else {
//std::cout << ">> PLAYER::execute_projectiles[" << (*enemy_it)->getName() << "] - DONT use hit_area" << std::endl;
}
short wpn_id = (*it).get_weapon_id();
//std::cout << "******* wpn_id: " << wpn_id << std::endl;
if (wpn_id < 0) {
wpn_id = 0;
}
//std::cout << ">> player weapon damage #1" << std::endl;
//std::cout << "******* (*enemy_it)->is_using_circle_weapon(): " << (*enemy_it)->is_using_circle_weapon() << ", (*it)->get_trajectory(): " << (*it)->get_trajectory() << ", TRAJECTORY_CHAIN: " << TRAJECTORY_CHAIN << std::endl;
// NPC using cicrcle weapon, is only be destroyed by CHAIN, but NPC won't take damage
if ((*enemy_it)->is_using_circle_weapon() == true ) {
if ((*it).get_trajectory() == TRAJECTORY_CHAIN) {
//std::cout << "PLAYER projectile hit NPC centered-weapon" << std::endl;
(*enemy_it)->consume_projectile();
}
(*it).consume_projectile();
return;
}
//.........这里部分代码省略.........
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:101,代码来源:classplayer.cpp
注:本文中的soundLib类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论