4 // Copyright (C) 2005 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 #include "fireworks.h"
24 #include "resources.h"
28 #include "app/globals.h"
29 #include "video/drawing_context.h"
30 #include "audio/sound_manager.h"
32 using namespace SuperTux;
34 Fireworks::Fireworks()
39 Fireworks::~Fireworks()
44 Fireworks::action(float )
47 Sector* sector = Sector::current();
48 Vector pos = sector->camera->get_translation();
49 pos += Vector(SCREEN_WIDTH * ((float) rand() / RAND_MAX),
50 SCREEN_HEIGHT/2 * ((float) rand() / RAND_MAX));
52 int red = rand() % 255;
53 int green = rand() % red;
54 sector->add_object(new Particles(pos, 0, 360, Vector(140, 140),
55 Vector(0, 0), 45, Color(red, green, 0), 3, 1.3,
56 LAYER_FOREGROUND1+1));
57 sound_manager->play_sound("fireworks");
58 timer.start(((float) rand() / RAND_MAX) + .5);
63 Fireworks::draw(DrawingContext& )