BadGuy::active_update(elapsed_time);
}
-HitResponse
-Snail::collision_solid(GameObject& object, const CollisionHit& hit)
+void
+Snail::collision_solid(const CollisionHit& hit)
{
- if(fabsf(hit.normal.y) > .5) { // floor or roof
+ if(hit.top || hit.bottom) { // floor or roof
physic.set_velocity_y(0);
switch (state) {
break;
}
- return CONTINUE;
+ return;
}
// hit left or right
switch(state) {
case STATE_KICKED: {
sound_manager->play("sounds/iceblock_bump.wav", get_pos());
-
+
+#if 0
+ // TODO move this into BonusBlock code
// open bonusblocks, crash bricks
BonusBlock* bonusblock = dynamic_cast<BonusBlock*> (&object);
if(bonusblock) {
if(brick) {
brick->try_break();
}
+#endif
dir = (dir == LEFT) ? RIGHT : LEFT;
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
}
}
-
- return CONTINUE;
}
HitResponse
{
switch(state) {
case STATE_NORMAL:
- if(fabsf(hit.normal.x) > .5) {
+ 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());