Game Development Reference
In-Depth Information
break;
}
}
}
Similar steps are used to determine if we have a viable block or not.
If we do have a side collision, the
_player
state is changed to
kPlayerDy-
ing
, we reverse its
x
speed so the
_player
state will move to the left and off
the screen, and we return from this method.
3. We end by updating the
_player
object's state based on our collision results:
if (inAir) {
player->setState(kPlayerFalling);
} else {
player->setState(kPlayerMoving);
player->setFloating (false);
}
}