How to make a map loading engine?
Root / Programming Questions / [.]
HTV04Created:
What I do is use data arrays to store the levels, and have a separate 2d array that stores the current level, and then read that array, set the BGtiles, then detect player collisions by check if the spaces around the player, and if it has a character that should be a block, then detect collision.
For enemies(this would be soooooo much easier with OOP), well, they are a work in progress, however the one I have implementing into my game so far is working quite well. What I do is have an array of enemie types, and separate arrays for their x, y, velX, velY, timer(used for whatever enemy needs to wait on, like hammer bros or piranahs in your case), and then I create functions to handle enemies and modify arrays accordingly. You are probably going to need more arrays to handle the enemy(I know I do, width, height, direction they are facing), and voila.
whoever thinks OOP useless will suffer my wrath
*pokes head in*
Although it's hard to do, (and I enjoy the puzzle element of doing so) I personally try to create generators instead of predefined levels.
Building levels using code, and getting the game to make the levels as it goes, is so much fun to do.
.. hard to get right, but great when you do.
*disappears again*
WAIT Sorry I put the wrong link
http://smilebasicsource.com/page?pid=1443