void Enemy::logic(int stage_velocity, string stage_name, int global_iteration, string username) { animationControl(); spellControl(stage_velocity); for (std::list<Pattern*>::iterator pattern = active_patterns->begin(); pattern != active_patterns->end(); pattern++) { Pattern* p = (Pattern*)*pattern; double distance_x= player->getHitbox().getX() - p->getX(); double distance_y= player->getHitbox().getY() - p->getY(); if (p->getHoming() != 0) { p->setAngle(-atan2(distance_y,distance_x)*180/PI); } else if(p->getAimPlayer()) { p->setAngle(p->getAngle()-atan2(distance_y,distance_x)*180/PI); } } if(this->hp>0) modifiersControl(); else { if(orientation!="destroyed" && flag_begin_upload) { orientation="destroyed"; if(this->sonido->soundExists(name+".destroyed")) this->sonido->playSound(name+".destroyed"); this->hitbox.setValues(0,0,0,0,0); //Delete bullets std::list<Pattern*>* active_patterns=getActivePatterns(); std::list<Pattern*>::iterator i = active_patterns->begin(); while (i != active_patterns->end()) { Pattern*p=(Pattern*)*i; active_patterns->erase(i++); delete p; } // RosalilaNetwork network(painter); // //score_upload_message = network.runTcpClientSendScore(31716, "108.59.1.187",stage_name, username, global_iteration); // score_upload_message = network.runTcpClientSendScore(31716, "localhost",stage_name, username, global_iteration); } } this->angle+=this->angle_change / getSlowdown(); this->x += cos (angle*PI/180) * velocity / getSlowdown() + stage_velocity; this->y -= sin (angle*PI/180) * velocity / getSlowdown(); getIterateSlowdownFlag(); }
void Character::logic(int stage_velocity) { animationControl(); spellControl(stage_velocity); if(current_color_effect_r<255) current_color_effect_r++; if(current_color_effect_g<255) current_color_effect_g++; if(current_color_effect_b<255) current_color_effect_b++; if(current_color_effect_a<255) current_color_effect_a++; }
void Player::logic(int stage_velocity) { animationControl(); if(this->hp!=0) { inputControl(); }else { if(orientation!="destroyed" && this->sonido->soundExists(name+".destroyed")) this->sonido->playSound(name+".destroyed"); orientation="destroyed"; //this->hitbox.setValues(0,0,0,0,0); } //Enable or disable slow if(isSlowPressed() && !slow_in_cooldown) { enableSlow(); current_slow-=slow_decrement; }else { disableSlow(); if(slow_in_cooldown) current_slow+=slow_cooldown_increment; else current_slow+=slow_increment; } //Check max and min slow if(current_slow<=0) { current_slow=0; } if(current_slow>max_slow) { current_slow=max_slow; } //Slow cooldown if(slow_in_cooldown && current_slow>=max_slow) { slow_in_cooldown=false; } if(!slow_in_cooldown && current_slow<=0) { slow_in_cooldown=true; } spellControl(stage_velocity); iteration++; }
void Character::logic(int stage_velocity) { animationControl(); spellControl(stage_velocity); }