SEGA Megadrive game development #6
Added 2020-03-29 15:40:08 +0000 UTCColliding with the environment
As he moves, our hero will eventually collide with something.
There is a function to check this being called when hero is moving (I removed it in the previous example for readability purpose):

This function both tells if the hero can keep on walking in a direction and if the element is colliding with has a specific interaction tied to it.
I saved some CPU by considering only sprites positioned close from the hero.