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
22 #include "fireworks.h"
23 #include "resources.h"
28 #include "video/drawing_context.h"
29 #include "audio/sound_manager.h"
31 Fireworks::Fireworks()
36 Fireworks::~Fireworks()
41 Fireworks::update(float )
44 Sector* sector = Sector::current();
45 Vector pos = sector->camera->get_translation();
46 pos += Vector(SCREEN_WIDTH * ((float) rand() / RAND_MAX),
47 SCREEN_HEIGHT/2 * ((float) rand() / RAND_MAX));
49 int red = rand() % 255;
50 int green = rand() % red;
51 sector->add_object(new Particles(pos, 0, 360, Vector(140, 140),
52 Vector(0, 0), 45, Color(red, green, 0), 3, 1.3,
53 LAYER_FOREGROUND1+1));
54 sound_manager->play_sound("fireworks");
55 timer.start(((float) rand() / RAND_MAX) + .5);
60 Fireworks::draw(DrawingContext& )