Jump to content
  • Advertisement
Sign in to follow this  
rishan1996

How do i make a level with tiles?

This topic is 2215 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am using C++ and SFML2.0 and c++ Visual 2010. I want to make a level out of tiles but do not know how to. So far this is what I have done. I got 1 tile type and i am putting it together in photoshop to make a map. I then separate each string of tiles and put them manually into the code. So for one map i will be making over 30 Sprites and turn them into blocks and draw them out, then i will have to make boundaries for them separately. This takes a very long time and i am sure that there is a much faster way for example using xml but i don't know how to put that into the code. If you need the code just ask and i will post. Also just to clarify i dont want to make a tile engine which automatically makes them like minecraft. I want to make a puzzle map like bloody trapland so I will have to place them myself. Please help, urgent.

Share this post


Link to post
Share on other sites
Advertisement
I'd recommend reading this thread also, where I've explained the basic idea: [size=2](At the risk of turning this forum into someplace that just responds with links)
http://www.gamedev.net/topic/629742-2d-overhead-tiling-engine/page__p__4970743#entry4970743

If neither of these links help you, if you ask specifically what part you are having difficulty with, we're happy to help.

Share this post


Link to post
Share on other sites
i have already seen http://www.gamedev.n...sfml-tile-maps/ and don't want this. i recently made a map using "tiled map creator" but it is only one layer will i need more than one? if so why(just so i know when to do it)? I am completely new also i am using SFML 2.0 not 1.6. The 2nd post helped a bit. Also just some background info. I am 16 and started learning c++ in july and have finished a book and online tutorials, i will still have to go over it to understand it better. I am learning at home as i am in school still doing A-Levels if you know what that is. I am completely new to SFML but i am picking it up quite quickly. This is just a little project that im doing so i can build a strong and solid base before i go to uni in 2 years time. plan to go into game development. sorry got a bit sidetracked.

so once again i have built a map using "Tiled map creator" i am just using one tile but has one layer , i dont know if i need more, if so tell me. i want to know how i can load that map which is in a weird format into my game using sfml 2.0. Edited by rishan1996

Share this post


Link to post
Share on other sites
i tried that before but did not understand how to install tinyxml and didnt understand it much. i am talking about the level.cpp and .h i will take a look again and try to understand it but on the weekend i dont have that much free time.

Share this post


Link to post
Share on other sites
Well, sometimes you run into walls. That's the time when you need to figure out how to get around or over the wall, instead of turning around and leaving thinking it a dead end.
If you couldn't figure out how to install tinyxml, that's the time to keep on trying to figure it out until you succeed, breaking each problem into tiny pieces and researching online how to get over that specific problem, step by step, until you succeed. If a specific problem gives you trouble, and after you've researched it and still can't find a solution, then post on a forums asking for help with that specific step (and mentioning what you've already tried).

I've never used tinyxml personally, but most libraries you don't "install", you download and then link to.

There will always be walls in your way; the skill you need to learn is how to get over them.

Share this post


Link to post
Share on other sites
Have you thought about a class or struct consisting of character arrays containing numeric letters to determine which tile to be used in conjuction with a function call to a scene renderer?

What I would do is create a class for the tiles, create a class for the scene renderer, and pass the appropriate tile/tiles as many times as you would like by simply sending an argument of which tile, how many tiles, their positions, to the scene renderer which then draws them on to the screen when necessary, and deletes the garbage(memory)needed when the tiles are offscreen or not shown, etc.

I'd say that SDL(SimpleDirect Media Layer)is a pretty easy library for blitting images to a window.

In SDL you can accomplish an image to the screen as easy as:


typedef SDL_Surface * LOAD;
LOAD Screen = SDL_SetVideoMode(800, 600, 32, SDL_FULLSCREEN);
LOAD PlayerImage = "IMAGE.jpg";
SDL_BlitSurface(PlayerImage, NULL, NULL, Screen);
SDL_Flip(Screen);
SDL_Delay(3000);


You can also add some more data to maybe flag certain tile types as "solid" so the playable character or enemy will not walk over or "through" it. Edited by Pointer2APointer

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!