void Projectile::setPath(QPointF source, QPointF target, Unit* enemy) { if (type_ >= PROJ_FIRE && type_ <= PROJ_FIRE_5) { QLineF distance = QLineF(source.x(), source.y(), target.x(), target.y()); switch(type_) { case PROJ_FIRE_2: distance.setLength(distance.length() * 90 / RADIUS_FLAME_2); break; case PROJ_FIRE_3: distance.setLength(distance.length() * 90 / RADIUS_FLAME_3); break; case PROJ_FIRE_4: distance.setLength(distance.length() * 90 / RADIUS_FLAME_4); break; case PROJ_FIRE_5: distance.setLength(distance.length() * 120 / RADIUS_FLAME_5); break; } end_ = new QPointF(distance.p2()); } else { end_ = new QPointF(target); } start_ = new QPointF(source); setEnemy(enemy); }
void enemyManager::loadEnemy() { char str[128], temp[150000]; //에너미 데이터 불러오기 sprintf_s(str, "Stage%d_enemy.txt", _stageNum); ifstream loadEnemy(str); int dataOrder = 0; //데이터 순서(개수) tagEnemy enemy; while (!loadEnemy.eof()) { loadEnemy.getline(temp, 100); if (dataOrder % 3 == 0) //0번째 데이터 type { enemy.type = (ENEMYTYPE)atoi(temp); } else if (dataOrder % 3 == 1) //1번째 데이터 x { enemy.x = atoi(temp); } else if (dataOrder % 3 == 2) //2번째 데이터 y { enemy.y = atoi(temp); setEnemy(enemy); } dataOrder++; } }
int main() { App::Get(); while (App::Get().isOpen()) { setEnemy(); App::Get().begin(); testDraw(); App::Get().end(); } }