summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2010-11-26 13:20:09 +0000
committerLuke Bratch <l_bratch@yahoo.co.uk>2010-11-26 13:20:09 +0000
commit4e986298d51b48a0033c9d0e8a9a32e9a21b3809 (patch)
tree84c1d95595b831a85b38cadd4cac8e79776fe256
parent4718c83d9204a0a9e2e0add143e829bbb9c0bff0 (diff)
Implement gravity
-rw-r--r--Level.cpp5
-rw-r--r--intensemarcus.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/Level.cpp b/Level.cpp
index 8268af8..f704c79 100644
--- a/Level.cpp
+++ b/Level.cpp
@@ -39,8 +39,13 @@ void Level::changeLevel(int levelNo) {
}
void Level::move() {
+ // Apply gravity
+ player.incYVel(GRAVITY);
+
// Player movements
player.setX(player.getX() + player.getXVel());
+ player.setY(player.getY() + player.getYVel());
+
player.orient();
}
diff --git a/intensemarcus.h b/intensemarcus.h
index 45bc78c..8386411 100644
--- a/intensemarcus.h
+++ b/intensemarcus.h
@@ -15,6 +15,7 @@ const int ORIENT_FRONT = 0;
const int ORIENT_BACK = 1;
const int ORIENT_RIGHT = 2;
const int ORIENT_LEFT = 3;
+const int GRAVITY = 3;
SDL_Surface *loadImage(std::string filename);