Log In  


Cart #10151 | 2015-04-23 | Code ▽ | Embed ▽ | No License

This is just me trying to learn how to use the map data. That tempting "door" at the top doesn't work yet.



Can you please explain how does collision works.
I been looking at your code but can't figure it out.


@digitalmonkey: Johnicholas has made a "clear?" function (top of the code) which is used in the update function to check (mget) if the map has a specific sprite (ID 2) at the new position (after button processing). This is done 4 times for all 4 directions in the clear(x,y) function. In the update function the code first checks if the new position in x and y direction is clear (to walk). If not then it tests the new x and y positions separately and applies what is clear (walkable).
I hope that helped.

Happy coding!



[Please log in to post a comment]