From 4e986298d51b48a0033c9d0e8a9a32e9a21b3809 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Fri, 26 Nov 2010 13:20:09 +0000 Subject: Implement gravity --- Level.cpp | 5 +++++ intensemarcus.h | 1 + 2 files changed, 6 insertions(+) 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); -- cgit v1.2.3