Collision Detection with Sliding Demo
That's it for collision detection. Included with the source for this chapter is the CollisionTestWithSliding class, which is exactly the same as the previous demo except that it implements sliding. All in all, it demonstrates sliding against a wall, sliding against objects, stepping over objects, getting on top of objects, scooting up stairs, applying gravity, and jumping. As a side effect to the engine, you can even stand on top of projectiles. Because projectiles stick to walls, you can fire enough projectiles to try to "draw" a ramp of them against the wall. Then you can run up the ramp! Of course, this is just how we implemented projectiles. Usually, you'll want projectiles to destroy themselves whenever they hit something rather than stick around.