Permalink
Browse files

Merge remote branch 'dreed/master'

  • Loading branch information...
2 parents 0e0b916 + 59f2833 commit e54f592e5ba01d6c9f558fcf4491a0838ce03b96 @jjohnso3 jjohnso3 committed Mar 8, 2011
Showing with 51 additions and 51 deletions.
  1. +39 −44 Mario.cpp
  2. +12 −7 Mario.h
View
@@ -13,7 +13,6 @@
//------------------------------------------------------------
void Mario::draw()
{
-
glColor3i(255, 0, 0);
int i;
for(i=0;i<4;++i){
@@ -24,20 +23,23 @@ void Mario::draw()
glVertex2d(getX(),getY()+16);
glEnd();
}
-
}
//------------------------------------------------------------
//constructor for Mario Class
Mario::Mario()
{
//init the private instance variables to default value
- state_ = 0;
- //will update to actaul height when figured out
- maxHeight_ = 0;
+ state_ = SMALL_STATE;
+ jumpCount_ = 0;
+
isInvincible_ = false;
- isJumping_ = false;
- isRunning_ = false;
- isFalling_ = false;
+
+ //init the keys
+ jumpKey_ = false;
+ rightKey_ = false;
+ leftKey_ = false;
+ sprintKey_ = false;
+
}
//------------------------------------------------------------
@@ -53,51 +55,44 @@ void Mario::updateKeyUp(unsigned char button)
}
//------------------------------------------------------------
-//method to calculate Marios Jump
-void Mario::jump()
+//method to calculate Marios movement
+void Mario::move()
{
- if (!isJumping_ && !isFalling_) {
- isJumping_ = true;
- }
- if (isJumping_) {
- if (this->getY() < maxHeight_) {
- if (isRunning_) {
- this->setY(this->getY() + 5);
- }
- else {
- this->setY(this->getY() + 3);
- }
- }
- else {
- isJumping_ = false;
- isFalling_ = true;
- }
- }
- if (isFalling_) {
- this->setY(this->getY() - 4);
- }
+ //sets Mario's x position to allowed distance
+ //this->setX(this->getX() + checkDistance(isRunning_));
+
}
//------------------------------------------------------------
-//method to calculate Marios movement
-void Mario::move(bool isRunning)
+//updates Mario for one Frame
+void Mario::updateScene()
{
- //Check right barrier for screen movement?
-
- if (check(isRunning_)) {
- if (isRunning_) {
- this->setX(this->getX() + 5);
- }
- else {
- this->setX(this->getX() + 3);
- }
- }
+
+
+
+}
+//------------------------------------------------------------
+//method that checks to see if Mario runs into or is hit by
+//an enemy
+bool Mario::checkEnemy()
+{
+
+
+
+
+
+
+
+ return false;
+
}
//------------------------------------------------------------
//method that calculate the intersections of Mario and objects
//to see if Mario runs into anything
-bool Mario::check(bool isRunning)
+int Mario::checkDistance()
{
- return false;
+
+
+ return 0;
}
//------------------------------------------------------------
//Creates a fireball
View
@@ -27,15 +27,20 @@ class Mario: public AllMovable {
private:
//State can be 0,1,2 depending if he is Big/Little/Fire Mario
- int state_, maxHeight_;
- bool isInvincible_, isJumping_, isRunning_, isFalling_;
-
- void jump();
+ int state_, jumpCount_;
+ bool isInvincible_;
+ bool jumpKey_, rightKey_, leftKey_, sprintKey_;
+
//Moves Mario to the left or right and calls check() at beginning
- void move(bool isRunning);
+ void move();
- //Checks to see if Mario ran into something
- bool check(bool isRunning);
+ //updates Mario
+ void updateScene();
+
+ //Checks to see if Mario ran into an enemy
+ bool checkEnemy();
+ //returns distance of allowed movement
+ int checkDistance();
//Returns true if Mario is in the fire state
bool fireball();

0 comments on commit e54f592

Please sign in to comment.