Robot::Robot(Game &_game, int _ownerid, int _x, int _y) : Unit(_game,_ownerid,_x,_y,1,1,100,10,true) { //If it's the first robot, then handle the image loading and clip dimensions if(robotSurface == NULL) { SDL_Surface * loadedImage = IMG_Load("Robot.png"); SDL_Surface * optimizedImage = SDL_DisplayFormatAlpha( loadedImage ); SDL_FreeSurface(loadedImage); robotSurface = optimizedImage; setClips(); } }
void Figure::initialize(int x, int y, double gravity, double speed, double jumpStrength, SDL_Surface* screen, Gravity gravityEnabled, bool leader, int numClips, int levelWidth, int levelHeight, Surface* p1, Surface* p2, Surface* p3, Surface* p4, Resolves resolve) { p.x = x; p.y = y; this->leader = leader; resolution = resolve; marker = ACTIVE; jumpFrame = 0; this->numClips = numClips; cl = new SDL_Rect[numClips]; cr = new SDL_Rect[numClips]; status = RIGHT; setClips(dim.w, dim.h); this->gravity = gravity; this->speed = speed; if (jumpStrength < 1) this->jumpStrength = 1; this->jumpStrength = jumpStrength; jumpAction = false; l = r = u = d = false; this->screen = screen; v.x = v.y = 0; switch (gravityEnabled) { case GRAVITY_ENABLED: this->gravityEnabled = true; break; case GRAVITY_DISABLED: this->gravityEnabled = false; this->jumpStrength = 1; break; default: throw GravityException(); break; } camera = new SDL_Rect; if (levelWidth == -1) lw = screen->w; else lw = levelWidth; if (levelHeight == -1) lh = screen->h; else lh = levelHeight; camera->x = camera->y = 0; camera->w = screen->w; camera->h = screen->h; particleEffects = false; this->p1 = this->p2 = this->p3 = this->p4 = NULL; if (p1 != NULL) { particleEffects = true; this->p1 = p1; } if (p2 != NULL) { particleEffects = true; this->p2 = p2; } if (p3 != NULL) { particleEffects = true; this->p3 = p3; } if (p4 != NULL) { particleEffects = true; this->p4 = p4; } if (particleEffects) { for (int i = 0; i < TOTAL_PARTICLES; i++) { particles[i] = new Particle(p.x, p.y, dim, this->p1, this->p2, this->p3, this->p4, screen); } } else { for (int i = 0; i < TOTAL_PARTICLES; i++) { particles[i] = NULL; } } }
Electrode::Electrode(string filename, int Price, int Damage, int x, int y):Bomb(filename, Price, Damage, x, y){ mod = 1; notExploded = 1; //because the first three images are Electrode moving, not exploding. mod will be changed to four when it hits the ground in the move function setClips(); }
Squirtle::Squirtle(string filename, int x, int y, int w, int h, int xV, int yV, int p, int hea):Enemy(filename, x, y, w, h, xV, yV, p, hea) { setClips(); }
Marowak::Marowak(string filename, int x, int y, int w, int h, int xV, int yV,int p, int hea):Enemy(filename,x,y,w,h,xV,yV,p,hea) { setClips(); }
Smg::Smg(string filename, string explosionName,string Name, int Price, int AmmoPrice, int Damage, int FireRate, int x, int y, int expsize,int max, int current, int maxclip, int currentclip):Weapon(filename, explosionName, Name, Price, AmmoPrice, Damage, FireRate,x,y, expsize,max,current,maxclip, currentclip){ setClips(); }
Pidgey::Pidgey(string filename, int x, int y, int w, int h, int xV, int yV, int p,int hea):Enemy(filename,x,y,w,h,xV,yV,p,hea) { setClips(); }
Charmander::Charmander(string filename, int x, int y, int w, int h, int xV, int yV, int p, int hea):Enemy(filename,x,y,w,h,xV,yV,p,hea) { setClips(); }
Rpoliwhirl::Rpoliwhirl(string filename, int x, int y, int w, int h, int xV, int yV, int p, int hea):Enemy(filename,x,y,w,h,xV,yV,p,hea) { setClips(); }