BouncingSnowball::BouncingSnowball(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/bouncing_snowball/bouncing_snowball.sprite")
-{
+{
}
BouncingSnowball::BouncingSnowball(const Vector& pos, Direction d)
- : BadGuy(pos, d, "images/creatures/bouncing_snowball/bouncing_snowball.sprite")
+ : BadGuy(pos, d, "images/creatures/bouncing_snowball/bouncing_snowball.sprite")
{
}
void
BouncingSnowball::activate()
{
- physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
+ physic.vx = (dir == LEFT ? -WALKSPEED : WALKSPEED);
sprite->set_action(dir == LEFT ? "left" : "right");
}
bool
-BouncingSnowball::collision_squished(Player& player)
+BouncingSnowball::collision_squished(GameObject& object)
{
sprite->set_action("squished");
- kill_squished(player);
+ kill_squished(object);
return true;
}
{
if(hit.bottom) {
if(get_state() == STATE_ACTIVE) {
- physic.set_velocity_y(JUMPSPEED);
+ physic.vy = JUMPSPEED;
} else {
- physic.set_velocity_y(0);
+ physic.vy = 0;
}
} else if(hit.top) {
- physic.set_velocity_y(0);
+ physic.vy = 0;
}
-
+
if(hit.left || hit.right) { // left or right collision
dir = dir == LEFT ? RIGHT : LEFT;
sprite->set_action(dir == LEFT ? "left" : "right");
- physic.set_velocity_x(-physic.get_velocity_x());
+ physic.vx = -physic.vx;
}
}
}
IMPLEMENT_FACTORY(BouncingSnowball, "bouncingsnowball")
-