Split game objects into separate .sprite files
[supertux.git] / src / object / rainsplash.cpp
1 //  SuperTux
2 //
3 //  This program is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU General Public License
5 //  as published by the Free Software Foundation; either version 2
6 //  of the License, or (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU General Public License for more details.
12 // 
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
16 //  02111-1307, USA.
17 #include "rainsplash.hpp"
18 #include "sector.hpp"
19
20 RainSplash::RainSplash(Vector pos, bool vertical)
21 {
22   frame = 0;
23   position = pos;
24   if (vertical) sprite = sprite_manager->create("images/objects/particles/rainsplash-vertical.sprite");
25   else sprite = sprite_manager->create("images/objects/particles/rainsplash.sprite");
26 }
27   
28 RainSplash::~RainSplash() {
29   remove_me();
30 }
31
32 void
33 RainSplash::hit(Player& )
34 {
35 }
36
37 void
38 RainSplash::update(float time) 
39 {
40   time = 0;//just so i don't get an "unused variable" error - don't know how to circumvent this
41   frame++;
42   if (frame >= 10) remove_me();
43 }
44
45 void
46 RainSplash::draw(DrawingContext& context) 
47 {
48    sprite->draw(context, position, LAYER_OBJECTS);
49 }