Releasing My 2D Tile Map Editor (And How to Use it)

I'm releasing my 2D tile editor. It's all written in Java but you can use the exported files in any language's program (as long as it can read text files!)
It's a pretty simple program and there are probably many rooms to improve but I hope it helps your game development!
Simple 2D Tile Editor:
* This is for Windows (Haven't checked it but probably won't work on Mac/Linux)*
Jar/Exe version (if you couldn't run the jar version, try the exe version!):
drive.google.com/drive/folder...
* You can use it for whatever project you are engaging in. However, please don't redistribute the editor.
* I stopped releasing the editor's source code because I was informed that someone was using/distributing it on their own platform, pretending that it was developed by them :(
Renamed Tiles:
drive.google.com/drive/folder...
Map and tile data file created with the editor
drive.google.com/drive/folder...
Timestamps:
0:00 Introduction
0:14 How to Use the Editor
9:32 Setting Collision
11:00 Saving the Map and Tile Data
13:05 Importing Files in the Game Program
24:15 Running the New Map
#tutorial #gamedevelopment #java2Dgame #leveleditor

Пікірлер: 128

  • @RyiSnow
    @RyiSnow Жыл бұрын

    Update (Aug 27, 2022) Released the Simple 2D Tile Editor version 1.01 Now you can select three editor sizes (small/medium/large) from the Editor Size menu. drive.google.com/drive/folders/1cxKDCfIbPVpgRfRN6PLco8eoV0bPNPQI?usp=sharing Update (Aug 26, 2022) Apparently, some people are having issues running the editor so I prepared an "exe" version too. The size is larger (173MB as zip) but it's no longer a jar file so it won't be affected by the version of your/my Java. How to use: 1. Download the zip file and extract 2. Click the "editor.exe" to run * Don't delete other files in the folder, especially jdk. The editor cannot run without it.

  • @kaishinigami1003

    @kaishinigami1003

    Жыл бұрын

    i need help, when i import my tiles, nothing happen, the select bar doesn't show the tiles even when i have tried the import tile sheet

  • @drazzo777cod7

    @drazzo777cod7

    6 ай бұрын

    Can you pls give the source code I want to learn this or at least give the way or skills or topics in Java I need to learn to make such a thing

  • @jaleneb4362

    @jaleneb4362

    3 ай бұрын

    did you ever figure out how to fix this? @@kaishinigami1003

  • @dash8497
    @dash8497 Жыл бұрын

    That editor is amazing! there are certainly more sophisticated editors out there, but yours is the only one that i need! Thanks for sharing :)

  • @Vivetal
    @Vivetal Жыл бұрын

    Huge thank you RyiSnow! I watched your older videos and made countless of Google searches how to make 2D tile editor in Java but I always hit the wall before I even got started. Your videos have been inspirational and educational. Keep up the good work!

  • @Macho-gd1yy
    @Macho-gd1yy Жыл бұрын

    RyiSnow i love all your videos this is helping me learn programming so much better I've seen other tile editors and have had issues trying to implement them into the game but your editor breaks it down to a simple level that allows everyone to use it I will definitely use your editor and I hope you continue to create more content you are my go to for learning and implementation of ideas thank you 👍

  • @sorcerian_bootleg7112
    @sorcerian_bootleg7112 Жыл бұрын

    Thank you very much for sharing this with us! I was really curious to see the code in it :D Always a pleasure to see you back with another video.

  • @IzmoRL
    @IzmoRL Жыл бұрын

    Thank you so much! I quit the 2d game but now Im looking forwards to using your tile editor to continue this game!

  • @Thothketic
    @Thothketic Жыл бұрын

    Friend, you are Genius. I start watch your videos and i learning a lot, please never stop.

  • @nimainer
    @nimainer Жыл бұрын

    Holy I cant even begin to think how you made this you are so talented

  • @luciuscouto4592
    @luciuscouto4592 Жыл бұрын

    I really liked your tile editor, and found it interesting to add a custom map size system for users who want to create a gigantic map 800x800 or a tiny map 10x10 for example.

  • @mramanshakya5019
    @mramanshakya5019 Жыл бұрын

    Your editor is great .It's extremely useful for this project..

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Happy to hear that :)

  • @manloloyojosh1458
    @manloloyojosh1458 Жыл бұрын

    AMAZING! RyiSnow! I will definitely reccomend you to my Programmer Professor! Your java tutorials and the tile editor is best!

  • @greatblackshark9646
    @greatblackshark9646 Жыл бұрын

    Oh my God. This will save so much time. This is amazing.

  • @oleksandr3275
    @oleksandr3275 Жыл бұрын

    Thanks for sharing your experience

  • @kyriehuehue473
    @kyriehuehue473 Жыл бұрын

    OMGGGGGGGGGGGGGGGGG i was just thinking about that and now u release it, thanks alot!!!

  • @jinweiwei7425
    @jinweiwei74252 ай бұрын

    it is indeed very helpful, thank you RyiSnow

  • @RisingCookie13
    @RisingCookie13 Жыл бұрын

    A...MAZING !!! :DD thank you soo much for sharing!! :D This is much easier, than sketching in gimp, and fill in the numbers myself x) as a total beginner I didn't know any tools for that yet ..but I don't think I'll need more than this :P

  • @Langostaz
    @Langostaz Жыл бұрын

    Great release !

  • @Loggog
    @Loggog Жыл бұрын

    Amazing video, Ryi!

  • @stratfender89
    @stratfender89 Жыл бұрын

    Thank you for your videos. I've learned a lot from them :D

  • @meows8603
    @meows8603 Жыл бұрын

    Sick man, thanks for sharing. Just wondering, do you have any plans to do 3d java programming tutorials?

  • @misterdneh
    @misterdneh Жыл бұрын

    This is perfect! I was wondering if you already released this editor in past videos but now it's available! I made an editor myself for Android called Maply - 2D Tilemap Game Maker to make your tutorials easier to edit worlds but yours is still better :D

  • @momagi6039
    @momagi6039 Жыл бұрын

    Very helpful! Thank you!

  • @cscruggs2158
    @cscruggs2158 Жыл бұрын

    Hi there! Your tutorials have been amazing and I've been following them recently in order to design my own game! I'm currently on part #12 but decided to go ahead and try out the tile editor and while it is great I think it would be really nice to have a feature to make a separate file to place objects on certain tiles. I tried to decompile the jar file you posted and add this myself but I believe I've ran into some issues where not everything decompiled correctly, would you mind if I took a look at the source code? Also I am a very new developer so I don't expect this to be a perfect implementation but wouldn't mind sending it back when (and if) I'm done!

  • @SunkenPotato
    @SunkenPotato Жыл бұрын

    YES I JUST NOTICED THIS IS GONNA SAVE MY LIFE

  • @Average_linux_user
    @Average_linux_user Жыл бұрын

    exactly what i need thanks you

  • @kpm25
    @kpm25 Жыл бұрын

    Thanks a lot RyiSnow!!

  • @linaskurtinaitis
    @linaskurtinaitis Жыл бұрын

    Nice video!

  • @Vivetal
    @Vivetal Жыл бұрын

    Kiitos! ありがとうございました!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Thank you for your kind support!!!

  • @HecarimsOfLove
    @HecarimsOfLove Жыл бұрын

    Hello, I've just followed all the guide and its amazing. I'm working on my own 2d game now and I was wondering if there is any way of creating a map with custom sizes, not the 50x50, 100x100 or 250x250 that are in the tile editor. Maybe you can make a guide on how to create the tile editor or share the script for the tile editor so we can edit it. Pls :)

  • @winhax4344
    @winhax4344 Жыл бұрын

    This inspired me to add the map size to the top of the document, that way you can use whatever map size you want. Also, I coded the tiles, objects, and events into the map data such as: 36,36 41,39,39,39,39,39,39,39,39,39,39,39,39,39,1010039,39,39,45,70003,46,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,42 40,160018,1,19,19,19,19,1200,1200,0,0,0,0,0,0,0,0,0,3,0,0,1200,1200,1200,0,0,6,6,6,6,6,6,6,6,6,40 In this case, there are 36 columns and 36 rows. Additionally, along with the map and collision data, I created another document for event data. The above shows the declaration of the map size, and just the first two lines of map data. I am parsing the data, starting from the right two characters. if there are only two characters, it means it is just a tile. If there are four characters, it means there is an object (not interactive) and a tile. For six or more characters, every two characters of the string refer to a tile, the next two refer to an object, the first characters refer to the event number from my list, currently 1 - 110. For example, where it says 1010039, it means event number 101, no object (00), and finally tile 39. In my event list, it says: 101@0@mapn1,2,24,UP. This is parsed up to the @ symbol. So, event 101, event type map change (0), load map; Mapn1; column 2; row 24, direction up (enum UP). The main difference is my code is done in Kotlin (Android Studio), originally it was coded in Java. Anyway, thanks for the confidence to try this!

  • @saschapolaschek4347
    @saschapolaschek4347 Жыл бұрын

    You are amazing Ryi

  • @OneLatteComingRightUp
    @OneLatteComingRightUp2 ай бұрын

    Hey Ryisnow, I'm a bit confused, on how to open any of the versions, do I need to click something? Where do I run it?

  • @lucasblaise2539
    @lucasblaise2539 Жыл бұрын

    Great job ! But if you want an advances usage for creating map (autotile, layer etc) you can use Tiled Map Editor (it's free software). It will be necessary to modify the java source code so that everything is compatible

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    I know what Tiled is. But I like creating these tools by myself so I can learn and improve my skill ;)

  • @HecarimsOfLove

    @HecarimsOfLove

    Жыл бұрын

    How would you modify the code to make th 2d game able to load the map made with tiled?

  • @termite1737
    @termite1737 Жыл бұрын

    I have a tileset png (download on the internet) , it includes a lot of tiles,but i don't know how to use it. You have lots of png images, but I have ONLY one. Do i have to cut my image into pieces to use your editor? I'm newbie in pixel art :((, sorry for my bad English. By the way, thank you for your tutorial, keep going !!!!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Actually, this editor supports tile sheets too (as long as its single tile size is 16x16). You can select "Import Tilesheet" from the File menu. But you need to arrange your code to read the map data and the tile data file that is exported from a tilesheet. So if you're following my tutorial and not sure what you're doing, using the same method that is shown in the video is probably less confusing.

  • @rogerdy2647
    @rogerdy264711 ай бұрын

    I've been wondering, how does this code read tile sheets? It would be great if it allows the tile sheet to be exported.

  • @arzunchandradas7937
    @arzunchandradas7937 Жыл бұрын

    What a great video! Straight to the point and perfectly explained. Thanks for uploading tNice tutorials!

  • @toadless4461
    @toadless4461 Жыл бұрын

    Suggestion: You should show us how to use dithering as lighting!

  • @MrLoser-ks2xn
    @MrLoser-ks2xn Жыл бұрын

    Thanks!

  • @noahbarger1
    @noahbarger1 Жыл бұрын

    i wonder if there could be one that can export to nes/snes

  • @Ki-dy6io
    @Ki-dy6io8 ай бұрын

    Hi Ryi, thank you for all the time you have spent to give us this amazing tutorial. I followed all the stuff you said but now when i change to the map with the Merchant the tiles are not getting drawn. Its just a black screen the player and the merchant. The Merchant is also for some reason moving downwards. Can you please help me?

  • @jurajchladny1952

    @jurajchladny1952

    Ай бұрын

    There's a most likely just a typo in your code. Look at the paint component and resolution for the tiles. Add debug lines to see if you are drawing the tiles correctly. Merchant probably has a swapped operator. (+ - . . . )

  • @keksmember
    @keksmember Жыл бұрын

    haha yes finally, no more painful number experience

  • @Talight-db9hj

    @Talight-db9hj

    23 сағат бұрын

    Yeah 😂

  • @pikachusglitch6646
    @pikachusglitch6646 Жыл бұрын

    Loving the editor. Is it possible to explain how you debugged the characters location while in gameplay?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    I've explained it in this video: kzread.info/dash/bejne/fYZksbB7eLyXg7g.html

  • @pikachusglitch6646

    @pikachusglitch6646

    Жыл бұрын

    @@RyiSnow thanks so much!

  • @christianfryksten8524

    @christianfryksten8524

    Жыл бұрын

    @@pikachusglitch6646 Is therre any chance you could share the code to me? I'm getting a input == null error

  • @pikachusglitch6646

    @pikachusglitch6646

    Жыл бұрын

    @@christianfryksten8524 `if(keyH.showDebugText){ long drawEnd = System.nanoTime(); long passed = drawEnd - drawStart; g2.setFont(new Font("Arial", Font.PLAIN, 20)); g2.setColor(Color.WHITE); int x = 10; int y = 400; int lineHeight = 20; g2.drawString("WorldX " + player.worldX, x , y); y += lineHeight; g2.drawString("WorldY " + player.worldY, x , y); y += lineHeight; g2.drawString("Col " + (player.worldX + player.solidArea.x) / tileSize, x , y); g2.drawString("Row " + (player.worldY + player.solidArea.y) / tileSize, x , y); g2.drawString("Draw Time: " + passed, 10 , 400); System.out.println("Draw Time: " + passed); }`

  • @caydemsiz
    @caydemsiz4 ай бұрын

    Hi RyiSnow,thank you for this amazing editor. I can’t seem to jump between maps with this new method, is there a tutorial for editing the code for this? I’m always stuck on the first map and changing the currentMap int to 1 doesn’t change the map that is displayed

  • @RyiSnow

    @RyiSnow

    4 ай бұрын

    I have explained how to edit the code for the editor in this video... did you watch it until the end?

  • @caydemsiz

    @caydemsiz

    4 ай бұрын

    Yes I did, multiple times. When it comes to adding new maps with your tile editor, I have no problems, but changing between those maps in game isnt possible for me. For example when I change the current map number in game panel to 1, I'm still stuck with the first map, named 0. I tried watching your episodes second by second to see if I've been missing anything but I cant find a mistake I've been looking over

  • @RyiSnow

    @RyiSnow

    4 ай бұрын

    @@caydemsiz Sounds like the issue doesn't have to do with this editor then, but more like how you constructed the multi-dimensional mapTileNum array and the loops to read it. I'd suggest rechecking the Part 38 video. Reading multi-dimensional arrays is kind of tricky and you can easily miss stuff.

  • @caydemsiz

    @caydemsiz

    4 ай бұрын

    @@RyiSnow Thank you again for your series, I’ve found my problem! I somehow managed to duplicate my current map instead of creating a new one, so the map actually did change, but since they have the same data, I thought it wasn’t changing..

  • @kelloxdrc9485
    @kelloxdrc9485 Жыл бұрын

    could you publish the code for the editor and the game in a zip folder instead of a jar file?

  • @adnan2734
    @adnan273411 ай бұрын

    "I don't know if you're using your computer in Japanese or Chinese etc, you're quite interesting! :)

  • @ceotus2455
    @ceotus2455 Жыл бұрын

    why do interactable tiles / monsters still display?

  • @lamrecode
    @lamrecodeАй бұрын

    Your tool just help us with tilemap, so how to add obj ?

  • @tofame4291
    @tofame42916 ай бұрын

    Any chance for open source? What I want to introduce is another layer. I mean, I want to divide tiles into ground layer and 2nd layer that will be walls etc. If all goes well I'd also introduce worldZ which means floors in-game. The thing is, I'd need to edit editor for that. So now Im wondering if I really need to either write my own map editor or make TileD compability which would be tremendous work... .json loading etc.... eh.

  • @jurajchladny1952

    @jurajchladny1952

    Ай бұрын

    Decompile it and use for your own work. Simple, I think it's even opensource. Also, I think you are thinking too complicated. The floors can be simply be portal to another map, which would be easier than "WorldZ" and more practical

  • @tofame4291

    @tofame4291

    Ай бұрын

    @@jurajchladny1952 Im already making a map loading saving based on protobuff from google. The only problem will be that map is required to have a key of type string. But other than that I think I will benefit a lot and have much more possibilities than with plain txt. I mean, I want to have many layers on one tile (ground, objects, items) and also many floors (Z). We will see. A ftiend programmer recommended me a quadtree but I have no idea how to do that right now. Someday I will learn. But anyway, im abandoning the idea of using this map editor. I will need to make my own one because of having different system of storing maps (.bin) Also I wont have a portal to another floor. It will be like 2 floor houses, check Tibia, that's how my flooring will work

  • @justguni7324
    @justguni73245 ай бұрын

    Hello RyiSnow. I have a problem, my drawTime is really high, it goes up to 12.000.000 nanoseconds. This was after implementing this new way to setup the tiles. before that my map was much simpler. is it because i now use many different tiles? do you have an idea how to fix this? im just on part 13 btw i just wanted to make a decent map before continuing.

  • @RyiSnow

    @RyiSnow

    5 ай бұрын

    Increasing tiles will increase the draw time but 12M sounds a bit too much. I just checked my final code (the one that I released on itch) and its draw time is around 2M so I think something went wrong.

  • @justguni7324

    @justguni7324

    5 ай бұрын

    @@RyiSnow ok thanks, ill check my code again

  • @HecarimsOfLove
    @HecarimsOfLove Жыл бұрын

    Hello, is there anyway to load maps with different sizes? I mean, map 0 could be a (50 x 50) and map 1 (100 x 100) and you can go between map 0 and 1 using a door just like you did in the game.

  • @christianfryksten8524

    @christianfryksten8524

    Жыл бұрын

    Hey man! Just wondering if you could share the code to me, I'm having some buggs

  • @HecarimsOfLove

    @HecarimsOfLove

    Жыл бұрын

    @@christianfryksten8524 I managed to edit the code to make it work so now i can load maps with different sizes. How do you want me to share the code with you?

  • @ksportalcraft

    @ksportalcraft

    11 ай бұрын

    @@HecarimsOfLove can you please share the code via pastebin with me if you would

  • @deliciouskromer3185
    @deliciouskromer3185 Жыл бұрын

    im still having the issue with the event tile

  • @lesterdev5276
    @lesterdev5276 Жыл бұрын

    I've found it! Thank you so much! do you have a tutorial on how to make this myself?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Unfortunately no. I was planning to create a tutorial but didn't have time for that so decided to just release it.

  • @lesterdev5276

    @lesterdev5276

    Жыл бұрын

    @@RyiSnow ohh that's unfortunate, but maybe I'll just check back to square one and learn everything from your source code. Huge thanks anyways!

  • @xedoes9970
    @xedoes9970 Жыл бұрын

    i was trying to use it on macOS but unfortunatelly map editor doesnt work at all also transparent places for tiles/maps are all white squares. will be there any fix? or i must use it on windows for now?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    In that case, I think this will be windows only. I don't own mac so I can't test it for that. Sorry about that!

  • @xedoes9970

    @xedoes9970

    Жыл бұрын

    @@RyiSnow No worries! But i am following Java tutorial and so far its running same ^^

  • @aarushkumar168
    @aarushkumar168 Жыл бұрын

    When is Blue Boy Adventure going to finish?

  • @josefortyfive214
    @josefortyfive214 Жыл бұрын

    Thank you so much!!

  • @josefortyfive214

    @josefortyfive214

    Жыл бұрын

    Hey I just need to ask? what java version are you using? I couldn't compile the jar file. It's saying that the jar is below 52.0

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    You don't need to compile it to use the editor. It's a stand-alone.

  • @josefortyfive214

    @josefortyfive214

    Жыл бұрын

    @@RyiSnow I'll double check my machine then. Thank you.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    I've uploaded an exe version too so if you're still struggling to run the editor, please try the exe version.

  • @christianfryksten8524
    @christianfryksten8524 Жыл бұрын

    I'm getting input == null! error and idk why

  • @clebersonpedreirapauluci4965
    @clebersonpedreirapauluci4965 Жыл бұрын

    Hi RyiSnow. I'm really appreciate your videos. I found a bug when importing the files. I'm using OS Ubuntu and for some reason the files isn't imported in the lexicographically order. Maybe you need to force the order of the files by their names in the application to garantie the order. Thanks!

  • @farrahzaki9625

    @farrahzaki9625

    Жыл бұрын

    same for me its not working :(

  • @kpm25
    @kpm25 Жыл бұрын

    Hi RyiSnow, is it possible to release it again with a resizable window? Appreciated

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    It's possible but needs a complete overhaul so might take a little time. Adding another size option is easier and quicker to be done. About what size would you prefer?

  • @kpm25

    @kpm25

    Жыл бұрын

    @@RyiSnow No worries I don't want to create more work for you. What dimension desktop do you use? I'm currently using 1920 x 1080. If you get time in the future this would als be a good code topic for tutorials. Appreciated! and looking forward to class #47 :)

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    My resolution is also 1920x1080. Actually, I was thinking to present this editor as a tutorial series but I abandoned the idea because it needs at least 5+ videos to explain everything and it was a bit too much for me at this point lol So I decided to just release it and explain the usage in a single video :P

  • @dcwavie
    @dcwavie Жыл бұрын

    life saver

  • @christianfryksten8524

    @christianfryksten8524

    Жыл бұрын

    Hey man! Did you get it to work? Any chance you could help me with a thing?

  • @dcwavie

    @dcwavie

    Жыл бұрын

    @@christianfryksten8524 whats wrong?

  • @Feroov
    @Feroov Жыл бұрын

    I found a bug, when I update my tiles collision, save data, when I try run the game the game is stuck on main menu after I click start game 🤔

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    That sounds like your code is failing to draw tiles. Make sure to place all the necessary files in the correct place. Are you getting any error messages on the console?

  • @Feroov

    @Feroov

    Жыл бұрын

    @@RyiSnow No errors or exceptions, but I will do it again slowly this time one by one

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Make sure to use the same tiles (with the same file names) in both the editor and the program!

  • @fuadcs22
    @fuadcs22Ай бұрын

    Release a standalone binary version without any runtime needs. Your product usage will be huge.

  • @FerodriEste
    @FerodriEste Жыл бұрын

    Hi Ryi, I tried to implement the worldmap.txt map, but I couldn't. I manage to run the game but it looks all black, the only thing you see are the interactive tiles... nothing more. Could you show how to implement the original map and the interior of the hut? Thanks a lot!!!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Did you replace the tile images?

  • @FerodriEste

    @FerodriEste

    Жыл бұрын

    @@RyiSnow yes, i put all the new ones (001, 002, etc)

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Did you copy the tiledata file too? Also, make sure not to load sample.txt to get the maxWorldCol. That is a 100x100 map.

  • @FerodriEste

    @FerodriEste

    Жыл бұрын

    @@RyiSnow yes i copy tiledata too. Also i used worldmap.txt not sample.txt. And i load the worldmap.txt The game starts but y cant see any tile, the rest (npc, interactive tile, and objects) i can see it.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    @@FerodriEste What if you load your original map? You still cannot see them? Are you getting any error messages btw?

  • @wonderzhou662
    @wonderzhou662 Жыл бұрын

    I think I left a comment before... but now it seems gone. Anyway. I am a mac user using the old version jar file. It somehow cannot run properly in my system. Anything is upside down even for the tile number and the way of display. The first tile is grass, and it will save as 0. It does not matter how I order each file. The first one is the new version of grass.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    This was developed in Windows so I think it needs a Mac wrapper to make it work in the Mac environment. So unfortunately this is Windows-only.

  • @wonderzhou662

    @wonderzhou662

    Жыл бұрын

    @@RyiSnow it should not have that big diff. this is java....

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    @@wonderzhou662 Did you use the Jar version or the exe version? Btw your comment is not gone. You commented on the community post.

  • @MrLoser-ks2xn
    @MrLoser-ks2xn7 ай бұрын

    🥰🥰🥰

  • @irnbrd
    @irnbrd Жыл бұрын

    Hello, i've got the black screen when start working with tileData(fail 22.txt). It's all ok, and i dont understand the reason of black screen. Can u look for it, mb u will solve this hateful situation public class TileManager { GamePanel gp; public Tile[] tile; public int mapTileNum[][]; ArrayList fileNames = new ArrayList(); ArrayList collisionStatus = new ArrayList(); public TileManager(GamePanel gp){ this.gp = gp; InputStream is = getClass().getResourceAsStream("/res/maps/22.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; try{ while((line = br.readLine()) != null){ fileNames.add(line); collisionStatus.add(br.readLine()); } br.close(); }catch(IOException e){ e.printStackTrace(); } //Initialize tile array of the tilename size tile = new Tile[fileNames.size()]; getTileImage(); is = getClass().getResourceAsStream("/res/maps/map01.txt"); br = new BufferedReader(new InputStreamReader(is)); try{ String line2 = br.readLine(); String maxTile[] = line2.split(" "); gp.maxWorldCol = maxTile.length; gp.maxWorldRow = maxTile.length; mapTileNum = new int[gp.maxWorldCol][gp.maxWorldRow]; br.close(); }catch(IOException e){ System.out.println("probem"); } loadMap("/res/maps/map01.txt"); } public void getTileImage(){ for(int i = 0; i String fileName; boolean collision; fileName = fileNames.get(i); if(collisionStatus.get(i).equals("true")){ collision = true; } else{ collision =false; } setup(i, fileName, collision); } // setup(0, "000", false); // setup(1, "001", false); // setup(2, "002", false); // setup(3, "003", false); // setup(4, "004", false); // setup(5, "005", false); // setup(6, "006", false); // setup(7, "007", false); // setup(8, "008", false); // setup(9, "009", false); // setup(10, "010", false); // setup(11, "011", false); // setup(12, "012", false); // setup(13, "013", false); // setup(14, "014", false); // setup(15, "015", false); // setup(16, "016", false); // setup(17, "017", false); // setup(18, "018", false); // setup(19, "019", false); // setup(20, "020", false); // setup(21, "021", false); // setup(22, "022", false); // setup(23, "023", false); // setup(24, "024", false); // setup(25, "025", false); // setup(26, "026", false); // setup(27, "027", false); // setup(28, "028", false); // setup(29, "029", false); // setup(30, "030", false); // setup(31, "031", false); // setup(32, "032", false); // setup(33, "033", false); } public void setup(int index, String imagePath, boolean collision){ UtilityTool uTool = new UtilityTool(); try{ tile[index] = new Tile(); tile[index].image = ImageIO.read(getClass().getResourceAsStream("/res/bg/"+ imagePath)); tile[index].image = uTool.scaleImage(tile[index].image, gp.tileSize, gp.tileSize); tile[index].collision = collision; }catch(IOException e){ e.printStackTrace(); } }

  • @icat7138

    @icat7138

    9 ай бұрын

    u fixed it?

  • @giorgioripani8469
    @giorgioripani8469 Жыл бұрын

    Instread of checking the string value of collisionStatus.get(i) in an if-else statemente you can call Boolean.parseBoolean(...) static method and pass collisionStatus.get(i) as argument! ;)

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Ah, you're right that will save some lines. Thank you for the suggestion!

  • @cristianojorge5596
    @cristianojorge55967 күн бұрын

    any fixes to this? Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 21 out of bounds for length 0 at main.CollisionChecker.checkTile(CollisionChecker.java:38) at entity.Entity.update(Entity.java:41) at main.GamePanel.update(GamePanel.java:141) at main.GamePanel.run(GamePanel.java:121) at java.base/java.lang.Thread.run(Thread.java:833)