summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2011-03-10 12:55:26 +0000
committerLuke Bratch <l_bratch@yahoo.co.uk>2011-03-10 12:55:26 +0000
commitaa0544a73122cd4f18bfcb28e8ddebf348686f5d (patch)
treed4852b50cf9402fb714d246caa24abbc0e374d97
parentc12fcf8e7663c20e2c2c0696fb35a7059b83127a (diff)
Ensure some variables are initialised
-rw-r--r--Level.cpp1
-rw-r--r--Player.cpp1
-rw-r--r--Sprite.cpp4
3 files changed, 4 insertions, 2 deletions
diff --git a/Level.cpp b/Level.cpp
index 652284d..e9fdb28 100644
--- a/Level.cpp
+++ b/Level.cpp
@@ -203,6 +203,7 @@ void Level::draw(Screen *screen) {
void Level::loadMap(int LevelNo) {
numPlatforms = 0;
+ numHazards = 0;
// TODO: Let each Platform have a reference a single tiles image
platform[0].setImage("tiles.png");
hazard[0].setImage("tiles.png");
diff --git a/Player.cpp b/Player.cpp
index 5995e4f..9ab733e 100644
--- a/Player.cpp
+++ b/Player.cpp
@@ -5,6 +5,7 @@ Player::Player() {
health = 100;
sprint = false;
crouch = 0;
+ numWeapons = 0;
setWeapon(0);
}
diff --git a/Sprite.cpp b/Sprite.cpp
index e920361..373b04e 100644
--- a/Sprite.cpp
+++ b/Sprite.cpp
@@ -2,6 +2,8 @@
#include "Sprite.h"
Sprite::Sprite() {
+ // Set initial clip to the whole image
+ clipNo = 0;
isVisible = true;
}
@@ -27,8 +29,6 @@ bool Sprite::visible() {
bool Sprite::setImage(std::string path) {
image = loadImage(path);
- // Set initial clip to the whole image
- clipNo = 0;
clip[0].x = 0;
clip[0].y = 0;
clip[0].w = image->w;