else if (badguy == "mriceblock")
Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir));
else if (badguy == "mrrocket") {
- int offset = (dir == LEFT ? -32 : 32);
- Sector::current()->add_object(new MrRocket(get_pos().x+offset, get_pos().y, dir));}
+ Sector::current()->add_object(new MrRocket(get_pos().x+(dir == LEFT ? -32 : 32), get_pos().y, dir));}
else if (badguy == "poisonivy")
Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir));
else if (badguy == "random")
#include "yeti.h"
#include "object/camera.h"
#include "yeti_stalactite.h"
+#include "bouncing_snowball.h"
static const float JUMP_VEL1 = 250;
static const float JUMP_VEL2 = 700;
physic.set_velocity_x(0);
}
+void
+Yeti::summon_snowball()
+{
+ Sector::current()->add_object(new BouncingSnowball(get_pos().x+(side == LEFT ? 64 : -64), get_pos().y, (side == LEFT ? RIGHT : LEFT)));
+}
+
HitResponse
Yeti::collision_player(Player& player, const CollisionHit& hit)
{
go_right();
} else if(state == GO_LEFT && !timer.started()) {
side = LEFT;
+ summon_snowball();
angry_jumping();
} else if(state == GO_RIGHT && !timer.started()) {
side = RIGHT;
+ summon_snowball();
angry_jumping();
} else if(state == ANGRY_JUMPING) {
if(!timer.started()) {
void go_left();
void angry_jumping();
void drop_stalactite();
+ void summon_snowball();
enum YetiState {
INIT,
GO_RIGHT,
GO_LEFT
};
- enum Side {
- LEFT,
- RIGHT
- };
- Side side;
+ Direction side;
YetiState state;
Timer2 timer;
int jumpcount;