1
\$\begingroup\$

I've been making a pokemon game clone on my own with Unity, as I'm a beginner and just trying to learn. Up until now I've been splicing the town pictures and manually putting them together, but this is extremely time consuming and takes several hours. Unity won't let me drag multiple sprites onto the scene, so I have to find another way. So currently my idea is to keep the image of the town as a single sprite, drag it onto the scene, and break it up into 16x16 pixel game objects, so I can add colliders and triggers and what not to each of the game objects. I found a way on the Internet to break up a single sprite into an array of sprites, but I don't know how to lay them out onto the scene. Can someone point me in the right direction and give some help? Thanks

\$\endgroup\$
  • 1
    \$\begingroup\$ Why not create a map editor instead of doing it the hard way? After you've created the map editor, you could save the tiles by giving them all an ID and writing them to a text file to load in the future... It would be a good learning curve and make things easier for you \$\endgroup\$ – Savlon Nov 28 '14 at 18:15
3
\$\begingroup\$

It sound to me as though you already have an entire map of the town drawn up and you are trying to break it down into 16px X 16px tiles for the sole purpose of adding triggers and colliders etc. Why not just keep the map as its own object and put your collider and trigger objects over it where you need them to be?

Really, a tile based map might be better in this case for memory and performance optimization. There are many free tools to do this already available in Unity's Asset Store. Or, you could create your own map editor - in the language of your choice, and have it export to a text file so that your games then could import them.

Good luck!

Best Regards, Ben

\$\endgroup\$
  • \$\begingroup\$ Wait a second, now I have a new problem. I made a tiled map using tiled, but the problem is that the extension '.tmx' isn't supported by unity. Atleast, when I click 'import assets..' and select it, nothing happens. I tried using X-UniTMX but it isn't helping at all. What do I do? \$\endgroup\$ – NewToUnity Nov 28 '14 at 22:50
  • \$\begingroup\$ The Tiled2Unity utility may help. \$\endgroup\$ – Kelly Thomas Nov 28 '14 at 23:19
  • \$\begingroup\$ I just tried that, but I'm getting this error when I try to load the .tmx file: Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click quit, the application will close immediately. Object reference not set to an instance of an object. \$\endgroup\$ – NewToUnity Nov 29 '14 at 3:11
  • \$\begingroup\$ @NewToUnity try seanba.com/introtiled2unity.html - I have not yet used this plug-in but it does seem worth the while. Anyway, that link shows how to get a map up and running in no time - step by step. Happy Coding! Let me know when you finish up your project and I will test for you :D \$\endgroup\$ – OverCodingUnderSleeping Nov 29 '14 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.