LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

How to make a map loading engine?

Root / Programming Questions / [.]

HTV04Created:
As a challenge, I want to try and recreate Super Mario Bros in SB. However, I'm a complete noob with maps. How can I make a map loading engine (and give it collision, as well as give enemies their properties)?

A bit while ago, while making a dungeon crawler, I made a scriptable map engine. Although it needs modifications for your usage, it might work as a reference or base for what you need. [NKYJJEHD]

So umm I am gonna make a resource or something, because this takes too long to explain in a thread :/ link:broken

As a challenge, I want to try and recreate Super Mario Bros in SB.
oh hey you chose the same nes game to try to port to sb except i was also trying to port lost levels and land and i never got past the sprite porting process because procrastination

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