Error when updating enumerated value?
- by igrad
Once upon a time, there was a Player class
(simplified version)
enum animState{RUNNING,JUMPING,FALLING,IDLING};
class Player
{
public:
Player(int x, int y);
void handle();
void show();
~Player();
private:
int m_x;
int m_y;
animState playerAnimState;
}
There was also a "handle" function-member, which took care of all movement and collisions for the player:
#include "player.h"
void Player::handle()
{
if(/*Player presses 'D' key*/)
{
m_x++;
playerAnimState = RUNNING;
} //Other stuff that is just there to look nice
Through lots of experimentation with "//" and "/**/", I've found that I consistently get an error at "playerAnimState = RUNNING." Have I broken some enumeration rule? Does my laptop really suck that bad? I hate to post a "fix my code for me" question, but I'm not very seasoned with enums.