00001 // 00002 // Copyright (C) 2002 Robert Renaud 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 // 00013 // See the GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 00020 #include "Bomb.h" 00021 00022 using namespace Game; 00023 00024 Bomb::Bomb(Sint16 x, Sint16 y, int bombRad, int moveSpeed, int numTicks) : 00025 MoveableItem(x, y, moveSpeed), 00026 bombRadius(bombRad), 00027 img(NULL), 00028 numTicksTilExplosion(numTicks) 00029 { 00030 // Graphics::AnimatedImage* wrappedImg=new Graphics::AnimatedImage("GameData/Bomb/bombAnimation.ani"); 00031 // wrappedImg->setTransparency(SDL_SRCCOLORKEY); 00032 // img=new Graphics::ImageFrame(wrappedImg, SDL_MapRGB(SDL_GetVideoSurface()->format, 100, 100, 100)); 00033 00034 img = new Graphics::AnimatedImage("GameData/Bomb/bombAnimation.ani", SDL_SRCCOLORKEY); 00035 } 00036 00037 Bomb::~Bomb() { 00038 delete img; 00039 img = 0; 00040 } 00041 00042 int Bomb::getBombRadius() { 00043 return bombRadius; 00044 } 00045 00046 bool Bomb::tick() { 00047 // if (!move()) return true; // moving bomb hit something, blow up 00048 numTicksTilExplosion--; 00049 return numTicksTilExplosion <= 0; 00050 } 00051 00052 void Bomb::draw(SDL_Surface* screen) { 00053 img->drawAt(screen, &picPosition); 00054 }
1.2.12 written by Dimitri van Heesch,
© 1997-2001