1
/***************************************************************************
2
* Copyright (C) 2004 by Bjorn Hansen *
3
* holomorph@users.sourceforge.net *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
22
#include <SDL/SDL_image.h>
23
#include "../include/probefactory.h" // class's header file
24
#include "../include/renderer.h"
25
#include "../include/soundmanager.h"
26
#include "../include/probe.h"
28
using namespace Balder;
31
ProbeFactory::ProbeFactory(Renderer* render, SoundManager* sound)
33
sprite = IMG_Load("probe.png");
36
throw "could not load Probe sprite!";
38
render->RegisterSpriteType("probe", sprite);
39
// now load the sounds
40
sound->LoadSoundType("fire", "sounds/fire.ogg");
41
sound->LoadSoundType("probe bounce", "sounds/probe_bounce.ogg");
42
sound->LoadSoundType("probe collide", "sounds/probe_collide.ogg");
43
sound->LoadSoundType("probe hit", "sounds/probe_hit.ogg");
44
sound->LoadSoundType("probe destroyed", "sounds/probe_destroyed.ogg");
45
sound->LoadSoundType("probe stick", "sounds/probe_stick.ogg");
46
sound->LoadSoundType("probe push", "sounds/probe_push.ogg");
47
sound->LoadSoundType("shields up", "sounds/probe_shields.ogg");
51
ProbeFactory::~ProbeFactory()
53
SDL_FreeSurface(sprite);
58
Probe* ProbeFactory::CreateProbe(GameManager* gm, double x_position, double y_position,
59
double x_velocity, double y_velocity, bool stuck, probe_color color, player_id pid)
61
return new Probe(gm, x_position, y_position, x_velocity, y_velocity, stuck, color, pid);