src/object/barrel.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Wormux is a convivial mass murder game.
00003  *  Copyright (C) 2001-2004 Lawrence Azzoug.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  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  * Petrol barrels
00020  *****************************************************************************/
00021 
00022 #include "barrel.h"
00023 #include "objects_list.h"
00024 #include "physical_obj.h"
00025 #include "../game/game_mode.h"
00026 #include "../particles/particle.h"
00027 #include "../tool/resource_manager.h"
00028 #include "../weapon/explosion.h"
00029 
00030 PetrolBarrel::PetrolBarrel() : PhysicalObj("barrel")
00031 {
00032   Profile *res = resource_manager.LoadXMLProfile( "graphism.xml", false);
00033   img= resource_manager.LoadSprite( res, "objet/barrel");
00034   resource_manager.UnLoadXMLProfile(res);
00035 
00036   life_points = 40;
00037 
00038   SetCollisionModel(false, true, true);
00039   SetSize(img->GetSize());
00040   SetTestRect (1, 1, 2, 2);
00041 }
00042 
00043 PetrolBarrel::~PetrolBarrel()
00044 {
00045   delete img;
00046 }
00047 
00048 void PetrolBarrel::Draw()
00049 {
00050   img->Update();
00051   img->Draw(GetPosition());
00052 }
00053 
00054 void PetrolBarrel::Refresh()
00055 {
00056 }
00057 
00058 void PetrolBarrel::SignalGhostState(bool was_already_dead)
00059 {
00060   ParticleEngine::AddNow(GetCenter() , 20, particle_FIRE, true);
00061   ApplyExplosion(GetCenter(), GameMode::GetInstance()->barrel_explosion_cfg);
00062 }

Generated on Mon Jan 1 13:10:59 2007 for Wormux by  doxygen 1.4.7