void STG::uploadReplay() { int replay_size=0; string seed_str = rosalila()->utility->toString(rosalila()->utility->random_seed); replay_size+=seed_str.size()+1; for(int i=0;i<(int)player->replay_storage.size();i++) { replay_size+=player->replay_storage[i].size()+1; } replay_size+=1; char*replay_data = new char[replay_size]; strcpy(replay_data,""); strcat(replay_data,seed_str.c_str()); strcat(replay_data,"\n"); for(int i=0;i<(int)player->replay_storage.size();i++) { strcat(replay_data,player->replay_storage[i].c_str()); strcat(replay_data,"\n"); } strcat(replay_data,"\0"); rosalila()->api_integrator->storeLeaderboardAttachment(stage->name,replay_data,replay_size); api_state = "uploading replay"; }
void STG::checkCharacterOutOfBounds() { if(player->x<stage->bound_x1+rosalila()->graphics->camera_x) player->x=stage->bound_x1+rosalila()->graphics->camera_x; if(player->x>stage->bound_x2+rosalila()->graphics->camera_x) player->x=stage->bound_x2+rosalila()->graphics->camera_x; if(player->y<stage->bound_y1) player->y=stage->bound_y1; if(player->y>stage->bound_y2) player->y=stage->bound_y2; }
bool Button::isDown() { if(uses_joystick) { if(rosalila()->receiver->isJoyDown(joystick_button,joystick_num)) return true; }else { if (rosalila()->receiver->isKeyDown(key)) return true; } return false; }
void STG::win() { int old_clears = rosalila()->api_integrator->getStat(stage->name+"Clears"); rosalila()->api_integrator->setStat(stage->name+"Clears",old_clears+1); if(player->hp == player->max_hp) { int old_perfects = rosalila()->api_integrator->getStat(stage->name+"Perfects"); rosalila()->api_integrator->setStat(stage->name+"Perfects",old_perfects+1); } setPlayerWon(true); setGameOver(true); setIsFirstWin(old_clears==0); rosalila()->api_integrator->unlockAchievement("B"); double milliseconds = SDL_GetTicks()-initial_ticks; double hp_penalty = (1.0 + ((double)player->max_hp-(double)player->hp)/100.0); score = milliseconds * hp_penalty; enemy->hp=0; rosalila()->graphics->screen_shake_effect.set(50,20,rosalila()->graphics->camera_x,rosalila()->graphics->camera_y); rosalila()->sound->playSound("you win", 2, 0, 0, false); enemy->deleteActivePatterns(); if(game_mode!="replay" && (score<current_player_best_score || current_player_best_score==-1)) { uploadScore(); } }
bool STG::isOutOfBounds(int pos_x,int pos_y) { int bullet_bound_addition_x = (stage->bound_x2-stage->bound_x1)/2; int bullet_bound_addition_y = (stage->bound_y2-stage->bound_y1)/2; if(pos_x<stage->bound_x1+rosalila()->graphics->camera_x-bullet_bound_addition_x ||pos_x>stage->bound_x2+rosalila()->graphics->camera_x+bullet_bound_addition_x ||pos_y<stage->bound_y1-bullet_bound_addition_y ||pos_y>stage->bound_y2+bullet_bound_addition_y ) { return true; } return false; }
void RosalilaSound::addSound(std::string variable,std::string value) { if(sounds.find(variable)==sounds.end()) { sounds[variable]=Mix_LoadWAV(value.c_str()); if(sounds[variable]) { rosalila()->utility->writeLogLine("Sound " + value + " loaded"); }else { rosalila()->utility->writeLogLine("Could not load sound " + value); } } }
void STG::uploadErrorLoop() { rosalila()->graphics->notification_handler.interruptCurrentNotification(); rosalila()->graphics->notification_handler.notifications.push_back( new Notification(getErrorImage(), rosalila()->graphics->screen_width/2-getErrorImage()->getWidth()/2, rosalila()->graphics->screen_height, rosalila()->graphics->screen_height-getErrorImage()->getHeight(), getNotificationDuration())); api_state = "error"; while(true) { if(rosalila()->receiver->isPressed("a")) { break; } rosalila()->graphics->draw2DImage ( image_upload_error, image_upload_error->getWidth(),image_upload_error->getHeight(), 0,0, 1.0, 0.0, false, 0,0, Color(255,255,255,current_training_transparency), 0,0, false, FlatShadow()); rosalila()->update(); } }
LayerFrame* Stage::getFrameFromNode(Node* frame_node) { Image *image_temp = NULL; string type; int width = 0; int height = 0; if(frame_node->hasAttribute("type")) type = frame_node->attributes["type"]; if(frame_node->hasAttribute("image_path")) { string image_path = "stages/"+name+"/images/"+frame_node->attributes["image_path"]; image_temp=rosalila()->graphics->getTexture(assets_directory+image_path); width = image_temp->getWidth(); height = image_temp->getHeight(); } if(frame_node->hasAttribute("width")) width = atoi(frame_node->attributes["width"].c_str()); if(frame_node->hasAttribute("height")) height = atoi(frame_node->attributes["height"].c_str()); return new LayerFrame(image_temp,type,width,height); }
void RosalilaSound::playMusic(std::string path,int loops) { stopMusic(); rosalila()->utility->writeLogLine("Playing music: "+path); music = Mix_LoadMUS(path.c_str()); Mix_PlayMusic(music,loops); current_music=path; }
int RosalilaSound::playSound(std::string variable, int channel, int loops, int panning, bool uses_camera) { if(!soundExists(variable)) { rosalila()->utility->writeLogLine("Error: "+variable+" sound does not exists."); return -1; } if(sounds[variable]!=NULL) { int return_channel = Mix_PlayChannel( channel, sounds[variable], loops); if(panning != 0) { if(uses_camera) panning -= rosalila()->graphics->camera_x; int left = panning*255/rosalila()->graphics->screen_width; Mix_SetPanning(return_channel, 254 - left, left); } return return_channel; } return -1; }
Stage::~Stage() { rosalila()->utility->writeLogLine("Deleting stage."); for(;!back.empty();) { Layer*layer=back.back(); back.pop_back(); delete layer; } for(;!front.empty();) { Layer*layer=front.back(); front.pop_back(); delete layer; } }
void STG::uploadScore() { api_state = "uploading score"; rosalila()->utility->writeLogLine("uploading score"); rosalila()->api_integrator->setScore(stage->name, score); rosalila()->graphics->notification_handler.notifications.push_back( new Notification(getLoadingImage(), rosalila()->graphics->screen_width/2-getLoadingImage()->getWidth()/2, rosalila()->graphics->screen_height, rosalila()->graphics->screen_height-getLoadingImage()->getHeight(), 999999)); }
std::string Button::getRosalilaInputs() { if(uses_joystick) { if(joystick_button>=0) return rosalila()->utility->toString(joystick_button); if(joystick_button==-8) return std::string("up"); if(joystick_button==-2) return std::string("down"); if(joystick_button==-4) return std::string("left"); if(joystick_button==-6) return std::string("right"); return std::string("d"); }else { return std::string(keyToString()); } }
STG::STG(Player*player,Enemy*enemy,Stage*stage,string game_mode, int current_player_best_score) { this->player=player; this->enemy=enemy; this->stage=stage; this->game_mode=game_mode; this->current_player_best_score = current_player_best_score; this->api_state = ""; this->score = -1; this->game_over_timeout = 128; this->image_upload_error = rosalila()->graphics->getTexture(assets_directory+"misc/upload_error.png"); this->image_training_box = NULL; this->image_training_x = NULL; this->image_training_bar = NULL; this->image_training_bar_fill = NULL; this->player_is_immortal = false; rosalila()->graphics->camera_y=0; frame=0; parry_count=0; charge_destroy_count=0; parry_dash_count=0; current_training_transparency=0; //XML Initializations string config_directory = assets_directory+"config.xml"; TiXmlDocument doc_t( (char*)config_directory.c_str() ); doc_t.LoadFile(); TiXmlDocument *doc; doc=&doc_t; TiXmlNode *config_file=doc->FirstChild("ConfigFile"); TiXmlNode *you_loose_node=config_file->FirstChild("YouLose"); int you_loose_x=atoi(you_loose_node->ToElement()->Attribute("x")); int you_loose_y=atoi(you_loose_node->ToElement()->Attribute("y")); int you_loose_animation_velocity=atoi(you_loose_node->ToElement()->Attribute("animation_velocity")); you_loose=Animation(you_loose_x,you_loose_y,you_loose_animation_velocity); if(you_loose_node->ToElement()->Attribute("sound")) { rosalila()->sound->addSound("you lose",assets_directory+you_loose_node->ToElement()->Attribute("sound")); } for(TiXmlNode* sprites_node=you_loose_node->FirstChild("sprite"); sprites_node!=NULL; sprites_node=sprites_node->NextSibling("sprite")) { std::string path=sprites_node->ToElement()->Attribute("path"); you_loose.addImage(rosalila()->graphics->getTexture(assets_directory+path)); } TiXmlNode *you_win_node=config_file->FirstChild("YouWin"); int you_win_x=atoi(you_win_node->ToElement()->Attribute("x")); int you_win_y=atoi(you_win_node->ToElement()->Attribute("y")); int you_win_animation_velocity=atoi(you_win_node->ToElement()->Attribute("animation_velocity")); you_win=Animation(you_win_x,you_win_y,you_win_animation_velocity); if(you_win_node->ToElement()->Attribute("sound")) { rosalila()->sound->addSound("you win",assets_directory+you_win_node->ToElement()->Attribute("sound")); } for(TiXmlNode* sprites_node=you_win_node->FirstChild("sprite"); sprites_node!=NULL; sprites_node=sprites_node->NextSibling("sprite")) { std::string path=sprites_node->ToElement()->Attribute("path"); you_win.addImage(rosalila()->graphics->getTexture(assets_directory+path)); } if(game_mode=="Stage select" || game_mode=="charge training" || game_mode=="parry training" || game_mode=="parry dash training" || "replay") { stageSelectModeInit(); } if(game_mode=="charge training") { image_training_bar=rosalila()->graphics->getTexture(assets_directory+"misc/training/bar.png"); image_training_bar_fill=rosalila()->graphics->getTexture(assets_directory+"misc/training/bar_fill.png"); charge_destroy_count_objective=300; player_is_immortal = true; } if(game_mode=="parry training") { image_training_box=rosalila()->graphics->getTexture(assets_directory+"misc/training/box.png"); image_training_x=rosalila()->graphics->getTexture(assets_directory+"misc/training/x.png"); parry_count_objective=3; player_is_immortal = true; } if(game_mode=="parry dash training") { image_training_bar=rosalila()->graphics->getTexture(assets_directory+"misc/training/bar.png"); image_training_bar_fill=rosalila()->graphics->getTexture(assets_directory+"misc/training/bar_fill.png"); parry_dash_count_objective=15; player_is_immortal = true; } setGameOver(false); setIsFirstWin(false); mainLoop(); }
void Stage::drawLayer(Layer* layer) { //Animation speed if(layer->time_elapsed>layer->frame_duration) { layer->current_frame++; layer->time_elapsed=0; } //Loop animation if(getIterateSlowdownFlag()) layer->time_elapsed++; if(layer->current_frame>=(int)layer->layer_frames.size()) layer->current_frame=0; if(getGameOver()) { if(getPlayerWon()) { layer_transparency=128; }else { layer->color.red -= 3; layer->color.green -= 3; layer->color.blue -= 3; if(layer->color.red < 0) layer->color.red = 0; if(layer->color.green < 0) layer->color.green = 0; if(layer->color.blue < 0) layer->color.blue = 0; } } //Paint LayerFrame* current_layer_frame = layer->layer_frames[layer->current_frame]; int frame_width=current_layer_frame->width; int frame_heigth=current_layer_frame->height; vector<DrawableRectangle*>rectangles; for(int i=0;i<rosalila()->graphics->screen_width/(frame_width+layer->separation_x)+2;i++) { int pos_x = layer->alignment_x + i*(frame_width+layer->separation_x); int pos_y = rosalila()->graphics->screen_height - frame_heigth - layer->alignment_y; if(current_layer_frame->type == "image") { Image* image = current_layer_frame->image; rosalila()->graphics->draw2DImage ( image, frame_width,frame_heigth, pos_x,pos_y, 1.0, 0.0, false, layer->depth_effect_x, layer->depth_effect_y, Color(layer->color.red,layer->color.green,layer->color.blue,layer->color.alpha), 0,0, false, FlatShadow()); } if(current_layer_frame->type == "rectangle") { rectangles.push_back(new DrawableRectangle(pos_x,pos_y,frame_width,frame_heigth,0,Color(layer->color.red,layer->color.green,layer->color.blue,layer->color.alpha))); } } rosalila()->graphics->drawRectangles(rectangles,layer->depth_effect_x,layer->depth_effect_y,true); for(int i=0;i<(int)rectangles.size();i++) { delete rectangles[i]; } if(layer->depth_effect_x>0) { if(rosalila()->graphics->camera_x/layer->depth_effect_x>frame_width+layer->separation_x+layer->alignment_x) { layer->alignment_x+=frame_width+layer->separation_x; } }else if(layer->depth_effect_x<0) { if(rosalila()->graphics->camera_x*-layer->depth_effect_x > frame_width+layer->separation_x+layer->alignment_x) { layer->alignment_x+=frame_width+layer->separation_x; } } }
void Stage::loadFromXML(std::string name) { this->name=name; rosalila()->utility->writeLogLine("Loading stage from XML."); Node* root_node = rosalila()->parser->getNodes(assets_directory+"stages/"+name+"/main.xml"); //Load settings music_path = assets_directory+"stages/"+name+"/music.ogg"; Node* nodo_bounds = root_node->getNodeByName("Bounds"); this->bound_x1=0; this->bound_y1=0; this->bound_x2=rosalila()->graphics->screen_width; this->bound_y2=rosalila()->graphics->screen_height; if(nodo_bounds->hasAttribute("x1")) this->bound_x1=atoi(nodo_bounds->attributes["x1"].c_str()); if(nodo_bounds->hasAttribute("y1")) this->bound_y1=atoi(nodo_bounds->attributes["y1"].c_str()); if(nodo_bounds->hasAttribute("x2")) this->bound_x2=atoi(nodo_bounds->attributes["x2"].c_str()); if(nodo_bounds->hasAttribute("y2")) this->bound_y2=atoi(nodo_bounds->attributes["y2"].c_str()); Node* nodo_misc=root_node->getNodeByName("Misc"); this->velocity=0; if(nodo_misc->hasAttribute("velocity")) this->velocity=atoi(nodo_misc->attributes["velocity"].c_str()); rosalila()->utility->writeLogLine("Loading stage's BackLayers."); vector<int>random_colors_r; vector<int>random_colors_g; vector<int>random_colors_b; int u=rosalila()->utility->getNonSeededRandomNumber()%3+1; for(int i=0;i<u;i++) { int random_number=rosalila()->utility->getNonSeededRandomNumber()%19; int random_color_r,random_color_g,random_color_b; if(random_number==0) { random_color_r=244;random_color_g=67;random_color_b=54; } if(random_number==1) { random_color_r=102;random_color_g=58;random_color_b=182; } if(random_number==2) { random_color_r=3;random_color_g=167;random_color_b=244; } if(random_number==3) { random_color_r=76;random_color_g=175;random_color_b=80; } if(random_number==4) { random_color_r=255;random_color_g=235;random_color_b=59; } if(random_number==5) { random_color_r=255;random_color_g=87;random_color_b=34; } if(random_number==6) { random_color_r=96;random_color_g=125;random_color_b=139; } if(random_number==7) { random_color_r=233;random_color_g=30;random_color_b=99; } if(random_number==8) { random_color_r=63;random_color_g=81;random_color_b=181; } if(random_number==9) { random_color_r=0;random_color_g=188;random_color_b=212; } if(random_number==10) { random_color_r=139;random_color_g=195;random_color_b=74; } if(random_number==11) { random_color_r=255;random_color_g=193;random_color_b=7; } if(random_number==12) { random_color_r=121;random_color_g=85;random_color_b=72; } if(random_number==13) { random_color_r=156;random_color_g=39;random_color_b=176; } if(random_number==14) { random_color_r=33;random_color_g=150;random_color_b=243; } if(random_number==15) { random_color_r=0;random_color_g=150;random_color_b=136; } if(random_number==16) { random_color_r=205;random_color_g=220;random_color_b=57; } if(random_number==17) { random_color_r=255;random_color_g=152;random_color_b=0; } if(random_number==18) { random_color_r=158;random_color_g=158;random_color_b=158; } random_colors_r.push_back(random_color_r); random_colors_g.push_back(random_color_g); random_colors_b.push_back(random_color_b); } map<string,list<int> >randomized_appereance; map<string,int>max_layers; int current_layer=0; vector<Node*> backlayer_nodes = root_node->getNodesByName("BackLayer"); for(int i=0;i<(int)backlayer_nodes.size();i++) { if(backlayer_nodes[i]->hasAttribute("randomize_appereance") && backlayer_nodes[i]->attributes["randomize_appereance"]=="yes") { string random_group=""; if(backlayer_nodes[i]->hasAttribute("random_group")) { random_group=backlayer_nodes[i]->attributes["random_group"]; } randomized_appereance[random_group].push_back(current_layer); } current_layer++; } //int max_layers=rosalila()->utility->getNonSeededRandomNumber()%3+1; //max_layer["a"]=rosalila()->utility->getNonSeededRandomNumber()%3+1; //max_layer["b"]=rosalila()->utility->getNonSeededRandomNumber()%3+1; max_layers["a"]=1+rosalila()->utility->getNonSeededRandomNumber()%2; max_layers["b"]=1+rosalila()->utility->getNonSeededRandomNumber()%3; for(map<string,list<int> >::iterator randomized_appereance_iterator=randomized_appereance.begin(); randomized_appereance_iterator!=randomized_appereance.end(); randomized_appereance_iterator++) { list<int>current_list=(*randomized_appereance_iterator).second; while((int)current_list.size()>max_layers[(*randomized_appereance_iterator).first]) { int random_to_remove = rosalila()->utility->getNonSeededRandomNumber()%current_list.size(); list<int>::iterator remove_iterator = current_list.begin(); for(int i=0;i<random_to_remove;i++) { remove_iterator++; } current_list.erase(remove_iterator); } randomized_appereance[(*randomized_appereance_iterator).first]=current_list; } current_layer=0; for(int i=0;i<(int)backlayer_nodes.size();i++) { bool included=false; if(!backlayer_nodes[i]->hasAttribute("randomize_appereance") || backlayer_nodes[i]->attributes["randomize_appereance"]!="yes") { included=true; }else { for(map<string,list<int> >::iterator randomized_appereance_iterator=randomized_appereance.begin(); randomized_appereance_iterator!=randomized_appereance.end(); randomized_appereance_iterator++) { list<int>current_list=(*randomized_appereance_iterator).second; for(list<int>::iterator i=current_list.begin(); i!=current_list.end(); i++) { if(current_layer==(*i)) { included=true; break; } } } } current_layer++; if(!included) { continue; } int frame_duration=0; if(backlayer_nodes[i]->hasAttribute("frame_duration")) frame_duration=atoi(backlayer_nodes[i]->attributes["frame_duration"].c_str()); if(backlayer_nodes[i]->hasAttribute("randomize_frame_duration")) frame_duration+=rosalila()->utility->getNonSeededRandomNumber()%atoi(backlayer_nodes[i]->attributes["randomize_frame_duration"].c_str()); int depth_effect_x=0; if(backlayer_nodes[i]->hasAttribute("depth_effect_x")) depth_effect_x=atoi(backlayer_nodes[i]->attributes["depth_effect_x"].c_str()); if(backlayer_nodes[i]->hasAttribute("randomize_depth_effect_x")) depth_effect_x+=rosalila()->utility->getNonSeededRandomNumber()%atoi(backlayer_nodes[i]->attributes["randomize_depth_effect_x"].c_str()); int depth_effect_y=0; if(backlayer_nodes[i]->hasAttribute("depth_effect_y")) depth_effect_y=atoi(backlayer_nodes[i]->attributes["depth_effect_y"].c_str()); if(backlayer_nodes[i]->hasAttribute("randomize_depth_effect_y")) depth_effect_y+=rosalila()->utility->getNonSeededRandomNumber()%atoi(backlayer_nodes[i]->attributes["randomize_depth_effect_y"].c_str()); int align_x=0; if(backlayer_nodes[i]->hasAttribute("align_x")) align_x=atoi(backlayer_nodes[i]->attributes["align_x"].c_str()); if(backlayer_nodes[i]->hasAttribute("randomize_align_x")) align_x+=rosalila()->utility->getNonSeededRandomNumber()%atoi(backlayer_nodes[i]->attributes["randomize_align_x"].c_str()); int align_y=0; if(backlayer_nodes[i]->hasAttribute("align_y")) align_y=atoi(backlayer_nodes[i]->attributes["align_y"].c_str()); if(backlayer_nodes[i]->hasAttribute("randomize_align_y")) align_y+=rosalila()->utility->getNonSeededRandomNumber()%atoi(backlayer_nodes[i]->attributes["randomize_align_y"].c_str()); int separation_x=0; if(backlayer_nodes[i]->hasAttribute("separation_x")) separation_x=atoi(backlayer_nodes[i]->attributes["separation_x"].c_str()); if(backlayer_nodes[i]->hasAttribute("randomize_separation_x")) separation_x+=rosalila()->utility->getNonSeededRandomNumber()%atoi(backlayer_nodes[i]->attributes["randomize_separation_x"].c_str()); vector<Node*> frame_nodes = backlayer_nodes[i]->getNodesByName("frame"); vector<LayerFrame*> layer_frames; for(int j=0;j<(int)frame_nodes.size();j++) { layer_frames.push_back(getFrameFromNode(frame_nodes[j])); } Color color(255,255,255,255); if(backlayer_nodes[i]->hasAttribute("randomize_color") && backlayer_nodes[i]->attributes["randomize_color"]=="yes") { int random_number_pos=rosalila()->utility->getNonSeededRandomNumber()%random_colors_r.size(); color.red=random_colors_r[random_number_pos]; color.green=random_colors_g[random_number_pos]; color.blue=random_colors_b[random_number_pos]; } if(backlayer_nodes[i]->hasAttribute("alpha")) color.alpha=atoi(backlayer_nodes[i]->attributes["alpha"].c_str()); back.push_back(new Layer(layer_frames,frame_duration,depth_effect_x,depth_effect_y,align_x,align_y,separation_x,color)); } rosalila()->utility->writeLogLine("Loading stage's FrontLayers."); vector<Node*> frontlayer_nodes = root_node->getNodesByName("FrontLayer"); //Load front layer for(int i=0;i<(int)frontlayer_nodes.size();i++) { int frame_duration=0; if(frontlayer_nodes[i]->hasAttribute("frame_duration")) frame_duration=atoi(frontlayer_nodes[i]->attributes["frame_duration"].c_str()); int depth_effect_x=0; if(frontlayer_nodes[i]->hasAttribute("depth_effect_x")) depth_effect_x=atoi(frontlayer_nodes[i]->attributes["depth_effect_x"].c_str()); int depth_effect_y=0; if(frontlayer_nodes[i]->hasAttribute("depth_effect_y")) depth_effect_y=atoi(frontlayer_nodes[i]->attributes["depth_effect_y"].c_str()); int align_x=0; if(frontlayer_nodes[i]->hasAttribute("align_x")) align_x=atoi(frontlayer_nodes[i]->attributes["align_x"].c_str()); int align_y=0; if(frontlayer_nodes[i]->hasAttribute("align_y")) align_y=atoi(frontlayer_nodes[i]->attributes["align_y"].c_str()); int separation_x=0; if(frontlayer_nodes[i]->hasAttribute("separation_x")) separation_x=atoi(frontlayer_nodes[i]->attributes["separation_x"].c_str()); std::vector <Image*> textures; std::vector <int> textures_size_x; std::vector <int> textures_size_y; vector<Node*> frame_nodes = frontlayer_nodes[i]->getNodesByName("frame"); vector<LayerFrame*> layer_frames; for(int j=0;j<(int)frame_nodes.size();j++) { layer_frames.push_back(getFrameFromNode(frame_nodes[j])); } Color color(255,255,255,255); if(backlayer_nodes[i]->hasAttribute("randomize_color") && backlayer_nodes[i]->attributes["randomize_color"]=="yes") { int random_number_pos=rosalila()->utility->getNonSeededRandomNumber()%random_colors_r.size(); color.red=random_colors_r[random_number_pos]; color.green=random_colors_g[random_number_pos]; color.blue=random_colors_b[random_number_pos]; } if(backlayer_nodes[i]->hasAttribute("alpha")) color.alpha=atoi(frontlayer_nodes[i]->attributes["alpha"].c_str()); front.push_back(new Layer(layer_frames,frame_duration,depth_effect_x,depth_effect_y,align_x,align_y,separation_x, color )); } delete root_node; rosalila()->utility->writeLogLine("Stage loaded succesfully from XML."); }
bool RosalilaReceiver::isDown(string action_name) { if(rosalila()->api_integrator->isUsingSteamController()) { if(action_name == "8") return rosalila()->api_integrator->isControllerActionDown("up") || rosalila()->api_integrator->isControllerActionDown("menu_up"); if(action_name == "2") return rosalila()->api_integrator->isControllerActionDown("down") || rosalila()->api_integrator->isControllerActionDown("menu_down"); if(action_name == "4") return rosalila()->api_integrator->isControllerActionDown("left") || rosalila()->api_integrator->isControllerActionDown("menu_left"); if(action_name == "6") return rosalila()->api_integrator->isControllerActionDown("right") || rosalila()->api_integrator->isControllerActionDown("menu_right"); if(action_name == "a") return rosalila()->api_integrator->isControllerActionDown("action") || rosalila()->api_integrator->isControllerActionDown("menu_select"); if(action_name == "b") return rosalila()->api_integrator->isControllerActionDown("back") || rosalila()->api_integrator->isControllerActionDown("menu_cancel"); return false; } return controls[action_name]->isDown(); }
int main() { rosalila()->init("../assets/config.json"); Image* image = rosalila()->graphics->getTexture("../assets/image.png"); Node* example_root_node = rosalila()->parser->getNodes("../assets/example.json"); std::string a = example_root_node->attributes["a"]; std::string b = example_root_node->attributes["b"]; Node* tag = example_root_node->getNodeByName("Tag"); std::string subtag = tag->attributes["Subtag"]; vector<Node*> array = example_root_node->getNodesByName("Array"); std::string array_string = ""; for(auto array_element : array) { array_string += array_element->attributes["value"] += ","; } while(true) { rosalila()->graphics->drawRectangle(0,0,rosalila()->graphics->screen_width,rosalila()->graphics->screen_height,0,0,0,0,255); rosalila()->graphics->drawText("a: " + a, 0, -100, true, true); rosalila()->graphics->drawText("b: " + b, 0, -50, true, true); rosalila()->graphics->drawText("Subtag: " + subtag, 0, 0, true, true); rosalila()->graphics->drawText("Array: " + array_string, 0, 50, true, true); rosalila()->update(); } return 0; }
void STG::findLeaderboard() { rosalila()->api_integrator->findLeaderboard(stage->name); api_state = "finding leaderboard"; }
void STG::stageSelectModeInit() { //stage->playMusic(); rosalila()->graphics->camera_x=0; current_training_transparency=0; }
void STG::lose() { setPlayerWon(false); setGameOver(true); rosalila()->sound->playSound("you lose", 4, 0, 0, false); }
void STG::logic() { float distance_x=enemy->x - player->x; float distance_y=enemy->y - player->y; float distance=sqrt(distance_x*distance_x+distance_y*distance_y); float damage_level=6-distance/250.0; for (std::list<Pattern*>::iterator pattern = enemy->active_patterns->begin(); pattern != enemy->active_patterns->end(); pattern++) { Pattern*p=(Pattern*)*pattern; if(!p->is_hit) { for(int i=0;i<(int)p->bullet->hitboxes.size();i++) { Hitbox h=p->bullet->hitboxes[i]->getPlacedHitbox(p->x,p->y,p->getBulletAngle()); if(player->isParrying() || player->isInvulnerable()) { if(!p->is_hit && p->collides_opponent && (player->collidesParry(h,0,0,0)||player->collides(h,0,0,0))) { p->hit(player->sound_channel_base+1,true); rosalila()->graphics->point_explosion_effect->explode(p->x,p->y,Color(255,255,255,200),15); if(player->isInvulnerable()) { if(!player->isOnIntro()) { int counter = rosalila()->api_integrator->getStat("TotalParryDashDestroys") + 1; rosalila()->api_integrator->setStat("TotalParryDashDestroys",counter); if(counter >= 15) { rosalila()->api_integrator->unlockAchievement("ParryDash1"); } if(counter >= 50) { rosalila()->api_integrator->unlockAchievement("ParryDash2"); } if(counter >= 200) { rosalila()->api_integrator->unlockAchievement("ParryDash3"); } if(counter >= 500) { rosalila()->api_integrator->unlockAchievement("ParryDash4"); } parry_dash_count++; if(game_mode=="parry dash training" && parry_dash_count==parry_dash_count_objective) { win(); } } } if(game_mode=="parry training" || game_mode=="parry dash training") { player->parry(true); }else { player->parry(false); } if(player->isParrying()) { if(!player->isOnIntro()) { if(player->invulnerable_frames_left==15) { int counter = rosalila()->api_integrator->getStat("TotalParries") + 1; rosalila()->api_integrator->setStat("TotalParries",counter); if(counter >= 3) { rosalila()->api_integrator->unlockAchievement("Parry1"); } if(counter >= 20) { rosalila()->api_integrator->unlockAchievement("Parry2"); } if(counter >= 100) { rosalila()->api_integrator->unlockAchievement("Parry3"); } if(counter >= 250) { rosalila()->api_integrator->unlockAchievement("Parry4"); } } parry_count++; if(game_mode=="parry training" && parry_count==parry_count_objective) { win(); } } } if(p->x>player->x) { p->angle=135; }else { p->angle=-135; } } }else if(p->collides_opponent && player->collides(h,0,0,0)) { rosalila()->graphics->point_explosion_effect->explode(p->x,p->y,Color(255,255,255,200),p->bullet->damage); p->hit(enemy->sound_channel_base+1,false); if(!player_is_immortal) player->hit(p->bullet->damage); parry_count = 0; rosalila()->graphics->screen_shake_effect.set(30,10,rosalila()->graphics->camera_x,rosalila()->graphics->camera_y); if(rosalila()->sound->soundExists(player->name+".hit")) rosalila()->sound->playSound(player->name+".hit", 3, 0, player->x, true); if(player->hp==0) { lose(); } } } } } for (std::list<Pattern*>::iterator pattern = player->active_patterns->begin(); pattern != player->active_patterns->end(); pattern++) { Pattern*p=(Pattern*)*pattern; if(!p->is_hit) { for(int i=0;i<(int)p->bullet->hitboxes.size();i++) { Hitbox h=p->bullet->hitboxes[i]->getPlacedHitbox(p->x,p->y,p->getBulletAngle()); if(p->collides_opponent && enemy->collides(h,0,0,0)) { rosalila()->graphics->point_explosion_effect->explode(p->x,p->y,Color(255,255,255,200),p->bullet->damage+damage_level*5); p->hit(player->sound_channel_base+1,false); enemy->hit(p->bullet->damage+damage_level); enemy->shakeScreen(p->bullet->damage+damage_level*3,p->bullet->damage+damage_level*2); if(rosalila()->sound->soundExists(enemy->name+".hit")) rosalila()->sound->playSound(enemy->name+".hit", 1, 0, enemy->x, true); if(enemy->hp==0) { win(); } } } } } //BulletxBullet Collision for (std::list<Pattern*>::iterator enemy_pattern_iterator = enemy->active_patterns->begin(); enemy_pattern_iterator != enemy->active_patterns->end(); enemy_pattern_iterator++) { Pattern*enemy_pattern=(Pattern*)*enemy_pattern_iterator; if(!enemy_pattern->is_hit) { for (std::list<Pattern*>::iterator player_pattern_iterator = player->active_patterns->begin(); player_pattern_iterator != player->active_patterns->end(); player_pattern_iterator++) { Pattern*player_pattern=(Pattern*)*player_pattern_iterator; if(player_pattern->collides_bullets||enemy_pattern->collides_bullets) { if(!player_pattern->is_hit) { vector<Hitbox*>enemy_hitboxes=enemy_pattern->bullet->hitboxes; for(int i=0;i<(int)enemy_hitboxes.size();i++) { Hitbox enemy_hitbox=enemy_hitboxes[i]->getPlacedHitbox(enemy_pattern->x,enemy_pattern->y,enemy_pattern->getBulletAngle()); vector<Hitbox*>player_hitboxes=player_pattern->bullet->hitboxes; for(int j=0;j<(int)player_hitboxes.size();j++) { Hitbox player_hitbox=player_hitboxes[j]->getPlacedHitbox(player_pattern->x,player_pattern->y,player_pattern->getBulletAngle()); if(!enemy_pattern->is_hit&&!player_pattern->is_hit&&enemy_hitbox.collides(player_hitbox)) { if(!player->isOnIntro()) { int counter = rosalila()->api_integrator->getStat("TotalChargeBulletDestroys") + 1; rosalila()->api_integrator->setStat("TotalChargeBulletDestroys",counter); if(counter >= 300) { rosalila()->api_integrator->unlockAchievement("ChargeDestroy1"); } if(counter >= 1000) { rosalila()->api_integrator->unlockAchievement("ChargeDestroy2"); } if(counter >= 5000) { rosalila()->api_integrator->unlockAchievement("ChargeDestroy3"); } if(counter >= 10000) { rosalila()->api_integrator->unlockAchievement("ChargeDestroy4"); } charge_destroy_count++; if(game_mode=="charge training" && charge_destroy_count==charge_destroy_count_objective) { win(); } } enemy_pattern->hit(enemy->sound_channel_base+1,false); player_pattern->hit(player->sound_channel_base+1,false); rosalila()->graphics->point_explosion_effect->explode(enemy_pattern->x,enemy_pattern->y,Color(255,255,255,200),15); } } } } } } } } int stage_displacement = stage->velocity; if(isSlowActive()) stage_displacement/=3; rosalila()->graphics->camera_x+=stage_displacement; player->logic(stage_displacement); player->x=player->x+stage_displacement; enemy->logic(stage_displacement,stage->name); //enemy->setX(enemy->x+stage_displacement); stage->logic(); deletePatterns(); checkCharacterOutOfBounds(); slowExtraControl(); if(api_state == "uploading score") { if(rosalila()->api_integrator->getState()=="finished") { uploadReplay(); rosalila()->utility->writeLogLine("uploading replay"); } if(rosalila()->api_integrator->getState()=="error") { uploadErrorLoop(); uploadScore(); } } if(api_state == "uploading replay") { if(rosalila()->api_integrator->getState()=="finished") { findLeaderboard(); rosalila()->utility->writeLogLine("finding leaderboard"); } if(rosalila()->api_integrator->getState()=="error") { uploadErrorLoop(); uploadReplay(); } } if(api_state == "finding leaderboard") { if(rosalila()->api_integrator->getState()=="finished") { rosalila()->graphics->notification_handler.interruptCurrentNotification(); rosalila()->graphics->notification_handler.notifications.push_back( new Notification(getSuccessImage(), rosalila()->graphics->screen_width/2-getSuccessImage()->getWidth()/2, rosalila()->graphics->screen_height, rosalila()->graphics->screen_height-getSuccessImage()->getHeight(), getNotificationDuration())); api_state=""; rosalila()->utility->writeLogLine("finished"); } if(rosalila()->api_integrator->getState()=="error") { uploadErrorLoop(); findLeaderboard(); } } if(!getGameOver()) frame++; }
void Stage::playMusic() { rosalila()->sound->playMusic(this->music_path,-1); }
void RosalilaReceiver::updateInputs() { //While there's events to handle SDL_Event event; while( SDL_PollEvent( &event ) ) { //If the user has Xed out the window if( event.type == SDL_QUIT ) { exit(0); } if( event.type == SDL_KEYDOWN ) { if(event.key.keysym.sym==SDLK_UP) is_key_pressed[SDL_SCANCODE_UP] = true; else if(event.key.keysym.sym==SDLK_DOWN) is_key_pressed[SDL_SCANCODE_DOWN] = true; else if(event.key.keysym.sym==SDLK_LEFT) is_key_pressed[SDL_SCANCODE_LEFT] = true; else if(event.key.keysym.sym==SDLK_RIGHT) is_key_pressed[SDL_SCANCODE_RIGHT] = true; else if(event.key.keysym.sym<322) is_key_pressed[event.key.keysym.sym] = true; else rosalila()->utility->writeLogLine("Key pressed but not supported:"+rosalila()->utility->toString(event.key.keysym.sym)); } if( event.type == SDL_KEYUP ) { if(event.key.keysym.sym==SDLK_UP) is_key_pressed[SDL_SCANCODE_UP] = false; else if(event.key.keysym.sym==SDLK_DOWN) is_key_pressed[SDL_SCANCODE_DOWN] = false; else if(event.key.keysym.sym==SDLK_LEFT) is_key_pressed[SDL_SCANCODE_LEFT] = false; else if(event.key.keysym.sym==SDLK_RIGHT) is_key_pressed[SDL_SCANCODE_RIGHT] = false; else if(event.key.keysym.sym<322) is_key_pressed[event.key.keysym.sym] = false; else rosalila()->utility->writeLogLine("Key pressed but not supported:"+rosalila()->utility->toString(event.key.keysym.sym)); } if( event.type == SDL_JOYBUTTONDOWN ) { for(int i=0; i<max_joystick_inputs; i++) { if ( event.jbutton.button == i && event.jbutton.which==0) { is_joy1_pressed[i]=true; } } for(int i=0; i<max_joystick_inputs; i++) { if ( event.jbutton.button == i && event.jbutton.which==1) { is_joy2_pressed[i]=true; } } } if( event.type == SDL_JOYBUTTONUP ) { for(int i=0; i<max_joystick_inputs; i++) { if ( event.jbutton.button == i && event.jbutton.which==0) { is_joy1_pressed[i]=false; } } for(int i=0; i<max_joystick_inputs; i++) { if ( event.jbutton.button == i && event.jbutton.which==1) { is_joy2_pressed[i]=false; } } } if( event.type == SDL_JOYHATMOTION) { //If joystick 0 has moved if( event.jhat.which == 0 ) { hat_left_pressed_player_1=false; hat_right_pressed_player_1=false; hat_up_pressed_player_1=false; hat_down_pressed_player_1=false; switch(event.jhat.value) { case 8://Left hat_left_pressed_player_1=true; break; case 2://Right hat_right_pressed_player_1=true; break; case 1://Up hat_up_pressed_player_1=true; break; case 4://Down hat_down_pressed_player_1=true; break; case 9://Left up hat_left_pressed_player_1=true; hat_up_pressed_player_1=true; break; case 3://Right up hat_right_pressed_player_1=true; hat_up_pressed_player_1=true; break; case 12://left down hat_left_pressed_player_1=true; hat_down_pressed_player_1=true; break; case 6://Right down hat_right_pressed_player_1=true; hat_down_pressed_player_1=true; break; } } if( event.jhat.which == 1 ) { joy_left_pressed_player_2=false; joy_right_pressed_player_2=false; joy_up_pressed_player_2=false; joy_down_pressed_player_2=false; switch(event.jhat.value) { case 8://Left joy_left_pressed_player_2=true; break; case 2://Right joy_right_pressed_player_2=true; break; case 1://Up joy_up_pressed_player_2=true; break; case 4://Down joy_down_pressed_player_2=true; break; case 9://Left up joy_left_pressed_player_2=true; joy_up_pressed_player_2=true; break; case 3://Right up joy_right_pressed_player_2=true; joy_up_pressed_player_2=true; break; case 12://left down joy_left_pressed_player_2=true; joy_down_pressed_player_2=true; break; case 6://Right down joy_right_pressed_player_2=true; joy_down_pressed_player_2=true; break; } } } if( event.type == SDL_JOYAXISMOTION ) { //If joystick 0 has moved if( event.jaxis.which == 0 ) { if( event.jaxis.axis == 0 ) { if( ( event.jaxis.value > -8000 ) && ( event.jaxis.value < 8000 ) ) { stick_left_pressed_player_1=false; stick_right_pressed_player_1=false; } else { if( event.jaxis.value < 0 ) { stick_left_pressed_player_1=true; stick_right_pressed_player_1=false; } else { stick_right_pressed_player_1=true; stick_left_pressed_player_1=false; } } } //If the Y axis changed else if( event.jaxis.axis == 1 ) { if( ( event.jaxis.value > -8000 ) && ( event.jaxis.value < 8000 ) ) { stick_up_pressed_player_1=false; stick_down_pressed_player_1=false; } else { if( event.jaxis.value < 0 ) { stick_up_pressed_player_1=true; stick_down_pressed_player_1=false; } else { stick_down_pressed_player_1=true; stick_up_pressed_player_1=false; } } } } if( event.jaxis.which == 1 ) { if( event.jaxis.axis == 0 ) { if( ( event.jaxis.value > -8000 ) && ( event.jaxis.value < 8000 ) ) { joy_left_pressed_player_2=false; joy_right_pressed_player_2=false; } else { if( event.jaxis.value < 0 ) { joy_left_pressed_player_2=true; joy_right_pressed_player_2=false; } else { joy_left_pressed_player_2=false; joy_right_pressed_player_2=true; } } } //If the Y axis changed else if( event.jaxis.axis == 1 ) { if( ( event.jaxis.value > -8000 ) && ( event.jaxis.value < 8000 ) ) { joy_up_pressed_player_2=false; joy_down_pressed_player_2=false; } else { if( event.jaxis.value < 0 ) { joy_up_pressed_player_2=true; joy_down_pressed_player_2=false; } else { joy_up_pressed_player_2=false; joy_down_pressed_player_2=true; } } } } } } }
void STG::mainLoop() { bool end_key_up_keyboard=false; initial_ticks=SDL_GetTicks(); for (;;) { if(rosalila()->receiver->isPressed("b") && api_state == "") { // int replay_size=0; // string seed_str = rosalila()->utility->toString(rosalila()->utility->random_seed); // replay_size+=seed_str.size()+1; // for(int i=0;i<player->replay_storage.size();i++) // { // replay_size+=player->replay_storage[i].size()+1; // } // replay_size+=1; // // char*replay_data = new char[replay_size]; // // strcpy(replay_data,""); // strcat(replay_data,seed_str.c_str()); // strcat(replay_data,"\n"); // // for(int i=0;i<player->replay_storage.size();i++) // { // strcat(replay_data,player->replay_storage[i].c_str()); // strcat(replay_data,"\n"); // } // strcat(replay_data,"\0"); // // ofstream out(stage->name.c_str()); // out.write(replay_data,replay_size); // out.close(); player->exit(); rosalila()->sound->playSound(std::string("Menu.back"), 1, 0, 0, false); break; } // if(rosalila()->receiver->isKeyPressed(SDLK_k)) // { //// string random_number = toString((rand()*999999)%1000); // rosalila()->graphics->screenshot(0,0, 1366, 768, stage->name +".bmp"); // } render(); logic(); // rosalila()->receiver->isKeyDown(SDLK_z) rosalila()->update(); if(getGameOver() && api_state == "") { game_over_timeout--; if(game_over_timeout<0) game_over_timeout=0; if(game_over_timeout==0) { if(rosalila()->receiver->isKeyPressed(SDLK_RETURN) || (rosalila()->receiver->isDown("a") && end_key_up_keyboard) ) { break; } if(!rosalila()->receiver->isDown("a")) end_key_up_keyboard=true; } } } }
bool RosalilaReceiver::isPressed(string action_name) { if(rosalila()->api_integrator->isUsingSteamController()) { if(action_name == "8" && button_up_flag) { if(rosalila()->api_integrator->isControllerActionDown("up") || rosalila()->api_integrator->isControllerActionDown("menu_up")) { button_up_flag = false; return true; } } if(action_name == "2" && button_up_flag) { if(rosalila()->api_integrator->isControllerActionDown("down") || rosalila()->api_integrator->isControllerActionDown("menu_down")) { button_up_flag = false; return true; } } if(action_name == "4" && button_up_flag) { if(rosalila()->api_integrator->isControllerActionDown("left") || rosalila()->api_integrator->isControllerActionDown("menu_left")) { button_up_flag = false; return true; } } if(action_name == "6" && button_up_flag) { if(rosalila()->api_integrator->isControllerActionDown("right") || rosalila()->api_integrator->isControllerActionDown("menu_right")) { button_up_flag = false; return true; } } if(action_name == "a" && button_up_flag) { if(rosalila()->api_integrator->isControllerActionDown("action") || rosalila()->api_integrator->isControllerActionDown("menu_select")) { button_up_flag = false; return true; } } if(action_name == "b" && button_up_flag) { if(rosalila()->api_integrator->isControllerActionDown("back") || rosalila()->api_integrator->isControllerActionDown("menu_cancel")) { button_up_flag = false; return true; } } if(!rosalila()->api_integrator->isControllerActionDown("up") && !rosalila()->api_integrator->isControllerActionDown("down") && !rosalila()->api_integrator->isControllerActionDown("left") && !rosalila()->api_integrator->isControllerActionDown("right") && !rosalila()->api_integrator->isControllerActionDown("action") && !rosalila()->api_integrator->isControllerActionDown("back") && !rosalila()->api_integrator->isControllerActionDown("menu_up") && !rosalila()->api_integrator->isControllerActionDown("menu_down") && !rosalila()->api_integrator->isControllerActionDown("menu_left") && !rosalila()->api_integrator->isControllerActionDown("menu_right") && !rosalila()->api_integrator->isControllerActionDown("menu_select") && !rosalila()->api_integrator->isControllerActionDown("menu_cancel") ) button_up_flag = true; return false; } return controls[action_name]->isPressed(); }
void intro() { Image* image = rosalila()->graphics->getTexture(assets_directory+"menu/rosalila.png"); Image* image2 = rosalila()->graphics->getTexture(assets_directory+"menu/flatshot.png"); int current_fade_in=0; rosalila()->graphics->notification_handler.notifications.push_back( new Notification(getLoadingImage(), rosalila()->graphics->screen_width/2-getLoadingImage()->getWidth()/2, rosalila()->graphics->screen_height, rosalila()->graphics->screen_height-getLoadingImage()->getHeight(), 999999)); int frames = 0; if(!rosalila()->api_integrator->isUsingApi()) { rosalila()->graphics->notification_handler.interruptCurrentNotification(); } while(true) { if(rosalila()->api_integrator->getState()!="loading" && frames > 180) { rosalila()->sound->playSound("Menu.confirm",1,0,0,0); rosalila()->graphics->notification_handler.interruptCurrentNotification(); break; } if(rosalila()->receiver->isPressed("a") && rosalila()->api_integrator->getState()!="loading") { rosalila()->sound->playSound("Menu.right",0,0,0,0); rosalila()->graphics->notification_handler.interruptCurrentNotification(); break; } if(rosalila()->receiver->isPressed("b")) { exit(0); } rosalila()->graphics->draw2DImage ( image, image->getWidth(),image->getHeight(), 0,0, 1.0, 0.0, false, 0,0, Color(current_fade_in,current_fade_in,current_fade_in,255), 0,0, false, FlatShadow()); current_fade_in+=2; if(current_fade_in>255) current_fade_in=255; frames++; rosalila()->update(); } int current_background_transparency=0; frames = 0; while(true) { if(frames > 180) { break; } if(rosalila()->receiver->isPressed("a")) { rosalila()->sound->playSound("Menu.right",0,0,0,0); break; } if(rosalila()->receiver->isPressed("b")) { exit(0); } rosalila()->graphics->draw2DImage ( image2, image2->getWidth(),image2->getHeight(), 0,0, 1.0, 0.0, false, 0,0, Color(255,255,255,current_background_transparency), 0,0, false, FlatShadow()); current_background_transparency+=2; if(current_background_transparency>255) current_background_transparency=255; frames++; rosalila()->update(); } }
void STG::render() { stage->dibujarBack(); if(player->hp>0) player->bottomRender(); if(enemy->hp>0) enemy->bottomRender(); if(player->hp>0) player->topRender(); if(enemy->hp>0) enemy->topRender(); stage->dibujarFront(); if(getGameOver() && score!=-1 && game_mode!="replay") { if(current_player_best_score==-1) { rosalila()->graphics->drawText(rosalila()->utility->toString(score), 0, 0, true, true); } else { int difference = score - current_player_best_score; string score_text = rosalila()->utility->toString(score); score_text += " ("; if(difference>0) score_text += "+"; score_text += rosalila()->utility->toString(difference); score_text += ")"; rosalila()->graphics->drawText(score_text,0, 0, true, true); } } if(enemy->hp==0) you_win.render(); if(player->hp==0) you_loose.render(); // rosalila()->graphics->drawText("Time: "+toString(iteration),25,70); // rosalila()->graphics->drawText(enemy->name,25,110); // rosalila()->graphics->drawText("Damage level: "+toString(damage_level),25,170); int tutorial_control_spacing_y=100; if(!player->isOnIntro()) current_training_transparency+=2; if(current_training_transparency>255) current_training_transparency=255; if(game_mode=="charge training") { rosalila()->graphics->draw2DImage ( image_training_bar_fill, image_training_bar_fill->getWidth()*(charge_destroy_count/charge_destroy_count_objective),image_training_bar_fill->getHeight(), rosalila()->graphics->screen_width/2-image_training_bar_fill->getWidth()/2,tutorial_control_spacing_y, 1.0, 0.0, false, 0,0, Color(255,255,255,current_training_transparency), 0,0, false, FlatShadow()); rosalila()->graphics->draw2DImage ( image_training_bar, image_training_bar->getWidth(),image_training_bar->getHeight(), rosalila()->graphics->screen_width/2-image_training_bar->getWidth()/2,tutorial_control_spacing_y, 1.0, 0.0, false, 0,0, Color(255,255,255,current_training_transparency), 0,0, false, FlatShadow()); } if(game_mode=="parry training") { for(int i=0;i<parry_count_objective;i++) { rosalila()->graphics->draw2DImage ( image_training_box, image_training_box->getWidth(),image_training_box->getHeight(), rosalila()->graphics->screen_width/2-(image_training_box->getWidth()/2)*3+i*(image_training_box->getWidth()+10),tutorial_control_spacing_y, 1.0, 0.0, false, 0,0, Color(255,255,255,current_training_transparency), 0,0, false, FlatShadow()); if(i<parry_count) { rosalila()->graphics->draw2DImage ( image_training_x, image_training_x->getWidth(),image_training_x->getHeight(), rosalila()->graphics->screen_width/2-(image_training_x->getWidth()/2)*3+i*(image_training_x->getWidth()+10),tutorial_control_spacing_y, 1.0, 0.0, false, 0,0, Color(255,255,255,current_training_transparency), 0,0, false, FlatShadow()); } } } if(game_mode=="parry dash training") { rosalila()->graphics->draw2DImage ( image_training_bar_fill, image_training_bar_fill->getWidth()*(parry_dash_count/parry_dash_count_objective),image_training_bar_fill->getHeight(), rosalila()->graphics->screen_width/2-image_training_bar_fill->getWidth()/2,tutorial_control_spacing_y, 1.0, 0.0, false, 0,0, Color(255,255,255,current_training_transparency), 0,0, false, FlatShadow()); rosalila()->graphics->draw2DImage ( image_training_bar, image_training_bar->getWidth(),image_training_bar->getHeight(), rosalila()->graphics->screen_width/2-image_training_bar->getWidth()/2,tutorial_control_spacing_y, 1.0, 0.0, false, 0,0, Color(255,255,255,current_training_transparency), 0,0, false, FlatShadow()); } // rosalila()->graphics->drawText("TotalParries:" + // rosalila()->utility->toString(rosalila()->api_integrator->getStat("TotalParries")), // 0, 0, false, false); // rosalila()->graphics->drawText("TotalCharges:" + // rosalila()->utility->toString(rosalila()->api_integrator->getStat("TotalCharges")), // 0, 50, false, false); // // rosalila()->graphics->drawText("TotalParryDashDestroys:" + // rosalila()->utility->toString(rosalila()->api_integrator->getStat("TotalParryDashDestroys")), // 0, 100, false, false); // // rosalila()->graphics->drawText("TotalChargeBulletDestroys:" + // rosalila()->utility->toString(rosalila()->api_integrator->getStat("TotalChargeBulletDestroys")), // 0, 150, false, false); //rosalila()->graphics->updateScreen(); }