void CBoss::Init() { CEnemyBase::Init(); sprite.SetTexture((CTexture*)FindItemBox("bosstex")); sprite.SetSpriteSize(200, 136); sprite.SetCenterPosition(CP_LEFT); battery.SetTexture((CTexture*)FindItemBox("bosstex")); battery.SetSpriteRect(200, 0, 240, 184); frame = 0; }
void CEnemy3::Init() { CEnemyBase::Init(); sprite.SetTexture((CTexture*)FindItemBox("cboss")); sprite.SetSpriteSize(128, 64); }
void TestScene::Init() { font = new DxFont(); this->AppendObject(font, 1, true); this->AppendItemBox("font", font); tex = new Texture("soccerball.png"); sprite = new Sprite(tex); this->AppendItemBox("tex", tex); this->AppendItemBox("sprite", sprite); r=0.f; AppendObject(new BGMusic("Kalimba.mp3"), 5, "BGM", true); AppendItemBox("BGM", FindObject("BGM")); bgm = dynamic_cast<BGMusic*>(this->FindItemBox("BGM")); //if(bgm) bgm->Play(); input = (Input*)FindObject("input"); if(input == NULL){ input = new Input(); AppendObject(input, 0, "input", true); } sound.Load("missile.wav"); Sound *se = new Sound(*(Sound*)FindItemBox("burst")); //se->EnableDeleteByEnd(); se->Play(); }
void CEnemy2::Init() { CEnemyBase::Init(); sprite.SetTexture((CTexture*)FindItemBox("zakotex")); sprite.SetSpriteSize(32, 32); sprite.SetFrame(6); }
bool CBoss::ActionDestroy() { frame++; if(frame < 500){ // 500フレーム目まではボス周辺でランダムに爆炎を発生させる if(frame % 5 == 0){ float xx = x + (float)(rand() % 500 - 250); float yy = y + (float)(rand() % 300 - 150); float sz = 1.0f + 2.0f * (float)rand() / (float)RAND_MAX; AppendObject(new CExplosion(xx, yy, sz, 0.0f, 0.0f), EXPLOSION_PRIORITY, true); } y += 0.2f; if(frame % 15 == 0){ ((CSound*)FindItemBox("explode1"))->Play(); } return false; }else{ // 500フレーム目で大爆発を起こす float xx, yy, a, s, z; for(int i = 0; i < 50; i++){ xx = x + (float)(rand() % 100 - 50); yy = y + (float)(rand() % 100 - 50); a = atan2f(x - xx, yy - y); s = 5.0f + 10.0f * (float)rand() / (float)RAND_MAX; z = 3.0f + 8.0f * (float)rand() / (float)RAND_MAX; AppendObject(new CExplosion(xx, yy, 2.0f, a, s), EXPLOSION_PRIORITY, true); } CSound *se = new CSound(*(CSound*)FindItemBox("explode3")); se->EnableDeleteByEnd(); se->Play(); return true; } }
void CEnemy1::Init() { CEnemyBase::Init(); sprite.SetTexture((CTexture*)FindItemBox("zakotex")); sprite.SetSpriteSize(32, 32); frame = 0; animframe = 0; y = -16.0f; accel_x = 0.0f; left = (x < 320.0f); }
void CEnemyBase::Damaged() { // 残り耐久度を1減らす hardness--; if(hardness == 0){ CSound *se = new CSound(*(CSound*)FindItemBox("explode1")); se->EnableDeleteByEnd(); se->Play(); // 爆発処理を追加 AppendObject(new CExplosion(x, y), EXPLOSION_PRIORITY, true); // 自身を削除 RemoveObject(this); } }
void CBoss::MiniExplosion() { // 大小からなる30個の爆炎を拡散させる float xx, yy, a, s; for(int i = 0; i < 30; i++){ xx = x + (float)(rand() % 300 - 150); yy = y + (float)(rand() % 100 - 50); a = atan2f(x - xx, yy - y); s = 2.0f + 4.0f * (float)rand() / (float)RAND_MAX; AppendObject(new CExplosion(xx, yy, 2.0f, a, s), EXPLOSION_PRIORITY, true); } ((CSound*)FindItemBox("explode2"))->Play(); }
void CEnemy3::Damaged() { hardness--; if(hardness == 0){ // 10個の爆炎をランダムで拡散させる for(int i = 0; i < 10; i++){ float angle = d2r((float)(36 * i)); float size = 0.5f + 2.0f * (float)rand() / (float)(RAND_MAX + 1); float speed = 1.0f + 5.0f * (float)rand() / (float)(RAND_MAX + 1); AppendObject(new CExplosion(x, y, size, angle, speed), EXPLOSION_PRIORITY, true); } CSound *se = new CSound(*(CSound*)FindItemBox("explode2")); se->EnableDeleteByEnd(); se->Play(); AppendObject(new CPowerupItem(x, y), PLAYER_PRIORITY, true); RemoveObject(this); } }
void CEnemyBase::Init() { player = (CPlayer*)FindItemBox("player"); }
void CEnemyBullet::Init() { sprite.SetTexture((CTexture*)FindItemBox("ebullet")); player = (CPlayer*)FindItemBox("player"); }
void CExplosion::Init() { sprite.SetTexture((CTexture*)FindItemBox("explode")); sprite.SetSpriteSize(64, 64); }