- if(state == INIT) {
- go_right();
- } else if(state == GO_LEFT && !timer.started()) {
- side = LEFT;
- summon_snowball();
- sprite->set_action("stand-right");
- angry_jumping();
- } else if(state == GO_RIGHT && !timer.started()) {
- side = RIGHT;
- summon_snowball();
- sprite->set_action("stand-left");
- angry_jumping();
- } else if(state == ANGRY_JUMPING) {
- if(!timer.started()) {
- // we just landed
- if (side == LEFT) // standing on the left, facing Tux who is on the right
- sprite->set_action("stand-right");
- else
- sprite->set_action("stand-left");
- jumpcount++;
- // make a stalactite falling down and shake camera a bit
- Sector::current()->camera->shake(.1, 0, 10);
- drop_stalactite();
-
- // go to other side after 3 jumps
- if(jumpcount == 3) {
- if(side == LEFT)
- go_right();
- else
- go_left();
- } else {
- // jump again
- timer.start(ANGRY_JUMP_WAIT);
- }
- }
+ switch (state) {
+ case JUMP_DOWN:
+ run();
+ break;
+ case RUN:
+ break;
+ case JUMP_UP:
+ break;
+ case BE_ANGRY:
+ // we just landed
+ if(!state_timer.started()) {
+ sprite->set_action((dir==RIGHT)?"stand-right":"stand-left");
+ stomp_count++;
+ drop_stalactite();
+
+ // go to other side after 3 jumps
+ if(stomp_count == 3) {
+ jump_down();
+ } else {
+ // jump again
+ state_timer.start(STOMP_WAIT);
+ }
+ }
+ break;
+ case SQUISHED:
+ break;