- BadGuy::active_update(elapsed_time);
-
- if (might_fall(601))
- {
- dir = (dir == LEFT ? RIGHT : LEFT);
- sprite->set_action(dir == LEFT ? "left" : "right");
- physic.set_velocity_x(-physic.get_velocity_x());
- }
-}
-
-void
-Spiky::collision_solid(const CollisionHit& hit)
-{
- if(hit.top || hit.bottom) { // hit floor or roof?
- physic.set_velocity_y(0);
- } else { // hit right or left
- dir = dir == LEFT ? RIGHT : LEFT;
- sprite->set_action(dir == LEFT ? "left" : "right");
- physic.set_velocity_x(-physic.get_velocity_x());
- }
-}
-
-HitResponse
-Spiky::collision_badguy(BadGuy& , const CollisionHit& hit)
-{
- if(hit.left || hit.right) {
- dir = dir == LEFT ? RIGHT : LEFT;
- sprite->set_action(dir == LEFT ? "left" : "right");
- physic.set_velocity_x(-physic.get_velocity_x());
- }
-
- return CONTINUE;