void Projectile::Init(Ship* owner, PROJECTILE_TYPE type, float x, float y, float w, bool active) { GameObject::Init(x, y, w, active); this->type = type; this->owner = owner; HGE* hge = hgeCreate(HGE_VERSION); switch (type) { case PROJ_BULLET: { tex = hge->Texture_Load("missile.png"); sprite.reset(new hgeSprite(tex, 0, 0, 40, 20)); sprite.get()->SetHotSpot(20, 10); } break; case PROJ_SEEKING_MISSLE: { tex = hge->Texture_Load("missile.png"); sprite.reset(new hgeSprite(tex, 0, 0, 40, 20)); sprite.get()->SetHotSpot(20, 10); } break; } hge->Release(); }
HPBAR::HPBAR(const char* hp_tex, const char* shield_tex, const char* delay_tex) { HGE *hge = hgeCreate(HGE_VERSION); tex1 = hge->Texture_Load(hp_tex); tex2 = hge->Texture_Load(shield_tex); tex3 = hge->Texture_Load(delay_tex); spr1 = new hgeSprite(tex1, 0, 0, 100, 17); spr2 = new hgeSprite(tex2, 0, 0, 100, 17); spr3 = new hgeSprite(tex3, 0, 0, 100, 17); spr3->SetColor(ARGB(255, 255, 0, 0)); spr1->SetColor(ARGB(255, 0, 255, 0)); spr2->SetColor(ARGB(255, 200, 200, 200)); font = new hgeFont("font1.fnt"); font->SetZ(SKILL_LAYER); font->SetScale(0.75); }
MUTI_POOL::MUTI_POOL(const char *flie,int nframes, float w, float h, float centerx, float centery) { HGE *hge = hgeCreate(HGE_VERSION); HTEXTURE pic = hge->Texture_Load(flie); boom = new hgeAnimation(pic, nframes, 30, 0, 0, w, h); boom->SetZ(SKILL_LAYER); boom->SetHotSpot(centerx, centery); }
BuffManager::BuffManager() { HGE *hge = hgeCreate(HGE_VERSION); HTEXTURE f = hge->Texture_Load("freeze.png"); HTEXTURE v = hge->Texture_Load("vertigo.png"); HTEXTURE t = hge->Texture_Load("toxic.png"); HTEXTURE m = hge->Texture_Load("MPrecover.png"); HTEXTURE e = hge->Texture_Load("extraattack.png"); toxicdebuff = new hgeSprite(t, 0, 0, BUFFSIZE, BUFFSIZE); vertigodebuff = new hgeSprite(v, 0, 0, BUFFSIZE, BUFFSIZE); freezedebuff = new hgeSprite(f, 0, 0, BUFFSIZE, BUFFSIZE); mprecover = new hgeSprite(m, 0, 0, BUFFSIZE, BUFFSIZE); extraattack = new hgeSprite(e, 0, 0, BUFFSIZE, BUFFSIZE); extraattack->SetHotSpot(1, 1); mprecover->SetHotSpot(1, 1); toxicdebuff->SetHotSpot(1, 1); vertigodebuff->SetHotSpot(1, 1); freezedebuff->SetHotSpot(1, 1); font = new hgeFont("font.fnt"); m_bHasInitialized = true; }
AnimObject::AnimObject(const char *name, int nframes, int fps, float w, float h, float centerx, float centery, int aID,bool infinite, float x1, float y1) { HGE* hge = hgeCreate(HGE_VERSION); tex = hge->Texture_Load(name); anim = new hgeAnimation(tex, nframes, fps, 0, 0, w, h); anim->SetHotSpot(centerx, centery); ID = aID; imgx = x1; imgy = y1; dead = false; angle = 0.0f; size = 1.0f; Isinfinite = infinite; }
Missile::Missile(char* filename, float x, float y, float w, int shipid, int _damage) : angular_velocity(0) , deleted(0) , damage(_damage) { HGE* hge = hgeCreate(HGE_VERSION); tex_ = hge->Texture_Load(filename); hge->Release(); sprite_.reset(new hgeSprite(tex_, 0, 0, 40, 20)); sprite_->SetHotSpot(20,10); x_ = x; y_ = y; w_ = w; ownerid = shipid; velocity_x_ = 200.0f * cosf(w_); velocity_y_ = 200.0f * sinf(w_); x_ += velocity_x_ * 0.5; y_ += velocity_y_ * 0.5; }
void ObjectPool::SetBWbools(const char* filename, int NumOfObject) { HGE *hge = hgeCreate(HGE_VERSION); HTEXTURE pic = hge->Texture_Load(filename); int width = hge->Texture_GetWidth(pic); int height = hge->Texture_GetHeight(pic); BWpic bwpic; bwpic.width = width; bwpic.height = height; bwpic.bools = (bool**)malloc(sizeof(bool*)*width); for (int i = 0; i < width; i++) bwpic.bools[i] = (bool*)malloc(sizeof(bool)*height); DWORD *color = hge->Texture_Lock(pic); for (int i = 0; i < width; i++) for (int j = 0; j < height;j++) if (GETR(color[j*width + i]) == 0 && GETG(color[j*width + i]) == 0 && GETB(color[j*width + i]) == 0) bwpic.bools[j][i] = true; else bwpic.bools[j][i] = false; bwpic.number = NumOfObject; hge->Texture_Unlock(pic); hge->Texture_Free(pic); BWpics.push_back(bwpic); BWpics.shrink_to_fit(); }