Save and Load - How to Make a 2D Game in Java #50

In this video, we implement a Serializable interface and create the save & load function so we can save our progress in a DAT file.
Guidelines for using Blue Boy Adventure's code and assets:
docs.google.com/document/d/1q...
Timestamps:
0:00 Bug Fix
2:58 Resetting the Status When Player Dies
9:48 Saving/Loading Player Stats
20:14 Saving/Loading Player Items
29:12 Saving/Loading Player Equipment
33:05 Saving/Loading the Objects on the Map
43:28 FINAL RESULT
#javagamedevelopment #javatutorial #2dactionrpg #serializable

Пікірлер: 95

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

    *CORRECTION & UPDATE* I was informed that the player's speed which has temporally been increased by a knockback attack doesn't get reset when you select retry. That is true I totally missed this one. So add the following line in the restoreStatus method. speed = defaultSpeed; Thank you Nienawidzoncy for reporting this! UPDATE (Oct 9, 2022) Based on the suggestion from @Giorgio Ripani, I revised the object loading system so you don't need to type the object names manually anymore. You can check the update here: kzread.info/dash/bejne/d2h3tcOKeNuffbQ.html

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

    Hello @RyiSnow. The code you provided is using a switch statement to create a new object based on the input itemName. This approach works, but it could be improved by using a more object-oriented approach, like using a factory pattern. Here's an example of how you could refactor your code using a factory pattern: 1) Create an interface EntityFactory: public interface EntityFactory { Entity create(GamePanel gp); } 2) Implement the interface for each object: public class OBJ_AxeFactory implements EntityFactory { @Override public Entity create(GamePanel gp) { return new OBJ_Axe(gp); } } // Do the same for other objects 3) Use a Map to store the factories: private Map factories; public void initFactories() { factories = new HashMap(); factories.put("Woodcutter's Axe", new OBJ_AxeFactory()); // Add other factories } 4) Modify the getObject method: public Entity getObject(String itemName) { EntityFactory factory = factories.get(itemName); return factory != null ? factory.create(gp) : null; } With this approach, you can easily add new objects without modifying the getObject method. Additionally, it follows the Open-Closed Principle (OCP), which states that a software entity should be open for extension but closed for modification. What you think about my way? Thank you for your videos.

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

    You have inspired me to start Java, you're the best man, I hope you never stop! Best of luck to you!

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

    Glad to see the series is still going. Just finished episode 28, I’ll be back to this video soon!

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

    RyiSnow Thank you for making these videos. As a beginner, I can say they are the among the most valuable I have ever seen!

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

    Hi bro! I just discovered your videos, i'm still on 4th vídeo and making a pause to create a world creator, but it's so Nice to see that You still working on this!! So great!

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

    I am following your tutorials and pls keep up your work. Your videos are so helpful. Even for my own little games i always check out your tutorial for some refferences. much love from Germany

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

    Hi Ryi amazing chapter as always. Thank you for continuing this series. I can't wait for the new season (dungeon!) Cheers!🍻

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    It's not really a new season :P I think the dungeon will be done with 2 videos or so and this tutorial will be finished!

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

    Full congratulations on reaching 10,000 subscribers. :)

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Thank you so much 😀

  • @flashthewolf6377
    @flashthewolf63775 ай бұрын

    Hey @RyiShow ... keep it up, love the game soooo much! You inspire Game Developers and Programmers all around the world, I can tell you that much! :D

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

    I REALLY NEEDED THIS! i was wondering what would be the best way to save and load in java, thanks!

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

    Looking good, keep it up! I've always used txt files for save/load because all games so far I've made have been single player games. I will have to check out serializable at some time =)

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Yeah depending on the project, text files work just fine. By the way congratulations on finishing your tutorial series!

  • @KaarinGaming

    @KaarinGaming

    Жыл бұрын

    @@RyiSnow Aye. Thanks :)

  • @wonderzhou662

    @wonderzhou662

    Жыл бұрын

    I subscribed to both channels: Kaarin Gaming and RyiSnow.

  • @KaarinGaming

    @KaarinGaming

    Жыл бұрын

    @@wonderzhou662 That's some GigaChad energy right there :D

  • @wonderzhou662

    @wonderzhou662

    Жыл бұрын

    @@KaarinGaming I really learn lots of good stuff from these two channels. Thank you!

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

    I hope you release this game & do some sort of awesome mini story or even a massive one! You've been my almighty teacher in game development mind you I've been developing your guide using Android Studio so lots I had to figure out but most of it still handles the same!

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

    Thank you! You help us a lot!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Thank you for your continuous support! いつもありがとう!

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

    Excellent series, I have just seen the 57 videos, thanks for the effort. Just a question, should not the dry trees in the path of the chest (latest minute after latest load game) show as a trunk instead of the dry trees when loading the game? We have been there, meaning the dynamic tiles transformed to the trunk should show instead of the dry trees in the opened chest path.

  • @Luquinha-qf4kb
    @Luquinha-qf4kb7 ай бұрын

    so... if using an enum... i can make an int variable for id of that enum, and then, in the save method, pick the int id, and then, in the load method, not only pull the id, but also setting the enum value based on the id?

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

    @RyiSnow I somehow got a bug where my map gets loaded 6 individual times when i start up the game. So now it takes actually quite long for the game to boot up! Does anyone have an idea what the problem could be?

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

    Hello RyiSnow. Can you fix so the Old_man dosn't block the blue boy? I mean when Old man is blocking he will turn arround and go to the other direction so he dosn't block anymore

  • @darkpaladin.
    @darkpaladin. Жыл бұрын

    Dude you're so amazing 👏

  • @OneLatteComingRightUp
    @OneLatteComingRightUpКүн бұрын

    Hi ryisnow. Why am I recieving a save and load exception? I've done everything correctly. Is it possible I mistyped something?

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

    great job!

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

    Do you intend to teach how to save the state of the day and the location of the character?

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

    For Interactive Tiles, are you planning on having that data saved or resetting when you load? From a Gameplay perspective it could get frustrating as a player having Interactive Tiles reset on save/loads, for example: I have a ladder that appears after destroying a typical rock (where the rock is placed there is a teleport event that sends them to another room in a cave). If I had to save and quit it could be a hassle having to uncover them again, but at the same time thats how Stardew valley and pokemon handles its caves / things you cut so you can pass through. It does add to the game, making it more challenging and helps make the game last longer. I am just thinking of the upcoming dungeon video, maybe having 2 different kinds of Interactive Tiles, one that resets and one that saves its updated status. I guess thats kinda just like objects vs interactive tiles. I am now just rambling lol . Thanks again! Cant wait for the next one!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    I'm not planning to save interactive tile info but I might do it later if I feel better that way. Either way is fine though and I think it depends on how you want to construct your game and gameplay.

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

    The best feature!

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

    Thanks!

  • @crackrokmccaib
    @crackrokmccaib10 ай бұрын

    This might be a dumb idea, but what if your entity classes implement serializable, could they be saved that way? It looks like wrapper classes implement serializable, so maybe that's why they can be saved.

  • @TORMENTUMM
    @TORMENTUMM9 ай бұрын

    Cool video

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

    It's ok to use sql to save data?

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

    Is there any way to add multiplayer to the game? If yes please let me know.

  • @ralph_d_youtuber8298
    @ralph_d_youtuber82988 ай бұрын

    For the switch case in 27:30 you could use an enum. Overkill? maybe but U get that safety

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

    Great job, Mr. RyiSnow! Your videos are like a drug - every time I look forward to. Thanks for your work! I have a question. Tell me, please, how can I make it so that projectiles can be changed as a weapon / shield? (like currentProjectile or something). I tried to do this for a long time, but in the end either projectile did not change, or there was an error: projectile is null. (I can't see the details for I'm tired) P.S.: I wanted to implement different spells for the wizzard

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    We implemented a different projectile in Part 30 so I'd recommend you to check it. We let the player throw rocks.

  • @gregoryfir3841

    @gregoryfir3841

    Жыл бұрын

    @@RyiSnow Yes, this is a great video! Sorry, but I still do not understand how you can change / select projectiles in the game itself as a sword / shield

  • @dustinodett

    @dustinodett

    27 күн бұрын

    @@gregoryfir3841 I just copied everything that was done for projectile and renamed it all to like "projectile1" so now i have rock and fireball. I'm thinking of adding lightning or poison as well. I am learning that a lot of what @RyiSnow teaches us can me manipulated to fit other ideas. Like I have enemies drop treasure chests that have a random chance and different loot. I plan to make different tiers of chests that can drop and thus have better loot.

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

    Do you intend to teach how to make cutscenes?

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

    Finally you answer my comments

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

    Why not create another ArrayList with all of the items in the game, and have an embedded for loop inside of the for loop for loading data. When the data is loaded it compares the int i of the save.dat file to the the ArrayList of all the items j by using name.equals() method, then, assign int i Entity to be equal to in j of the ArrayList of all of the items in the game?

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

    Maybe I did something wrong but my character is faster after retry when it dies from orc attack. I'm guessing it has to do something with knockback effect. Could you tell me what could go wrong?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    When you search for the reason for an error, try focusing on what the error is about. Here's an example of how to track your code and fix an error: 1. What should be the main focus? > The character moves faster so that means it is something about the *player's speed*. 2. Why is this happening? > The speed value has changed at some point and *never returned to normal* 3. So the objective is? > *Tracking the changes in the player's speed* 4. What increased the player's speed? > We already know this: knockback 5. What should have reset the player's speed? > When retry gets selected, we need to reset the player's speed so the speed becomes normal. But that's not happening for some reason. 6. So where to check? > Track the speed value around retry in the code. Check what methods are called when you pick retry and why the speed value doesn't get reset. Focusing on the point and narrowing down the scope is the trick. When you learn it, fixing errors become much easier. I think I know what's causing it but I want you to find it by yourself. Good luck!

  • @Nienawidzoncy

    @Nienawidzoncy

    Жыл бұрын

    @@RyiSnowThanks for the challenge! To fix the problem all I did was adding: speed = defaultSpeed; in the restoreStatus() command. But still I dont know where I made mistake that coused the problem. In your video You dont have to reset the player speed.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    We added the line (speed = defaultSpeed) when we implemented the knockback function (around 8:35 in Part 41) so it resets the player's speed. Maybe you didn't watch that part?

  • @Nienawidzoncy

    @Nienawidzoncy

    Жыл бұрын

    @@RyiSnow I watched every video from this tutorial and I have checked the implementation of knockback and I'm pretty sure I did everything as You showed us. Well it's working after that litlle fix mentioned earlier. But for testing could you try to run into orcs attack and die then retry, maybe its a bug. Also I noticed after I died few times that way when my character got very fast I could not get close enough solid blocks(trees) from right hand side to enter 1 tilesize wide tiles.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Ohhh you're right. I totally forgot about the fact that the method is not getting called when retrying. I'll fix the code. Thank you for pointing this out and apologize for the confusion!

  • @bk-entertainz7081
    @bk-entertainz7081 Жыл бұрын

    Which video did you teach how to do sounds and music? THANK YOU SO MUCH for making these video's!!!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Part 9!

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

    Hi Ryisnow, I have a question about a feature I am trying to implement in my game. I was trying to implement building, but the way I did it didn't seem to work. Could you please share an idea on how to implement building (like putting down interactiveTiles such as bricks, wood, etc.)

  • @woodswoody5553

    @woodswoody5553

    Жыл бұрын

    I just created the building than put each image 16x16 as a tile of that building in grid

  • @greatvast2143

    @greatvast2143

    Жыл бұрын

    @@woodswoody5553 I don't mean it like that, I mean being able to have an interactive tile in your inventory (brick, wood, etc.) and being able to place it when you click a key. Kind of like minecraft.

  • @woodswoody5553

    @woodswoody5553

    Жыл бұрын

    @@greatvast2143 oh yeah that makes sense I’ll try something out and get back to you

  • @woodswoody5553

    @woodswoody5553

    Жыл бұрын

    @@greatvast2143 I guess you could make certain grass tiles interactive, so that when you have for example brick in your inventory the tile will change to brick when the "b" key is pressed for instance while in contact with that specific tile. It would be a similar implementation (like dryTree) but instead of the is destroyed etc... changeToBrick() method could be called in place and change that tile. Ill try it out rn I got a good idea of what Im doin

  • @woodswoody5553

    @woodswoody5553

    Жыл бұрын

    Yeah I got it to work. U just gotta Make interactive tiles but its not pitch perfect rn. I still got some bugs to deal with. Make wood a material for instance and a new entity CurrentMaterial and do the same as you did with the weapons with selection etc.

  • @testtestt-jf9gd
    @testtestt-jf9gd Жыл бұрын

    use hashmap for the inventory player saving.

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

    Hi Ryi and fellow Game Programmers, first of all thank you very much Ryi your tutorial series is incredible and I've learnt a lot! 26:25 I think there is a convenient way to this by using an Enum. In an Enumeration we can list all OBJs and their attributes. (I list the steps and code for everyone who wants to try) 1) First create a new package named "enums" 2) Create a Enum named "AllObjects": ### Code ### package enums; public enum AllObjects { AXE(0, "Woodcutter's Axe"), // OBJ-enum-name (id, objectname) BOOTS(1, "Boots"), KEY(2, "Key"), LANTERN(3, "Lantern"), RED_POTION(4, "Red Potion"), BLUE_SHIELD(5, "Blue Shield"), WOOD_SHIELD(6, "Wood Shield"), NORMAL_SWORD(7, "Normal Sword"), TENT(8, "Tent"), CHEST(9, "Chest"), DOOR(10, "Door"), COIN_BRONZE(11, "Bronze Coin"), HEART(12, "Heart"), MANA_CRYSTAL(13, "Mana Crystal"), TEST(999, "Test"); private final int ID; // not used at the time private final String OBJECTNAME; // Constructor AllObjects(int id, String name) { this.ID = id; this.OBJECTNAME = name; } // Getters public int Id() { return ID; } public String Objectname() { return OBJECTNAME; } } ### /Code ### 3) In each OBJ class we now can initialize the object's name as follows: ### in class OBJ_Axe ### import enums.AllObjects; // import the Enum [...] name = AllObjects.AXE.Objectname(); ### in class OBJ_Boots ### import enums.AllObjects; // import the Enum [...] name = AllObjects.BOOTS.Objectname(); etc. 4) Within the SaveLoad-class the method getObject(String itemName) can be changed like so: ### Code ### public Entity getObject(String itemName) { Entity obj = null; // Iterate over all Objects in our Enumeration for (AllObjects enumObj : AllObjects.values()) { // If the Enum-Objectname equals the passed itemName... if (enumObj.Objectname().equals(itemName)) { // ... then return the specific OBJ switch (enumObj) { case AXE: obj = new OBJ_Axe(gp); break; case BOOTS: obj = new OBJ_Boots(gp); break; case KEY: obj = new OBJ_Key(gp); break; case RED_POTION: obj = new OBJ_Potion_Red(gp); break; case LANTERN: obj = new OBJ_Lantern(gp); break; case BLUE_SHIELD: obj = new OBJ_Shield_Blue(gp); break; case WOOD_SHIELD: obj = new OBJ_Shield_Wood(gp); break; case NORMAL_SWORD: obj = new OBJ_Sword_Normal(gp); break; case TENT: obj = new OBJ_Tent(gp); break; case CHEST: obj = new OBJ_Chest(gp); break; case DOOR: obj = new OBJ_Door(gp); break; case COIN_BRONZE: obj = new OBJ_Coin_Bronze(gp); break; case HEART: obj = new OBJ_Heart(gp); break; case MANA_CRYSTAL: obj = new OBJ_ManaCrystal(gp); break; } } } return obj; } ### /Code ### That should work and the names of all OBJs are only hardcoded in the Enum. Hope that was helpful Thanks for reading!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Thank you for sharing your method and providing a detailed explanation! Yeah, that looks like a nice alternative. It requires a little extra typing but we can surely avoid mistyping object names and updating the case conditions whenever we update those names. I'll try it later and see how I like it. Thanks again!

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

    Hi Ryisnow, In my game I implemented storage chests. I wanted their loot to be saved and loaded. I tried to add this feature, but it did not work out. Is there any way you could show me on how to save an array (chest loot) and load it?

  • @dustinodett

    @dustinodett

    27 күн бұрын

    Do it like we did the merchant. It took some playing around to get it just right but the merchant is a great template for this.

  • @dustinodett

    @dustinodett

    27 күн бұрын

    Oh! I see what you're saying now. Yeah my storage did not save. If I figure this out I will update here.

  • @dustinodett

    @dustinodett

    27 күн бұрын

    I am 99% sure I figured this outI am not sure if all the steps I went through are needed though. I did get the game to load with items I placed in my chest. I will double check and if anyone responds to this I will share what I did.

  • @sabawaheed1142

    @sabawaheed1142

    5 күн бұрын

    Hello! Thanks for helping me figure out the issue. I believe a while back I fixed the issue by saving the amount of items as an integer and then saving each item in the array on a separate line. for loading, I read the amount of items and used that to loop through the following items in order to create the chest array. My video game is called Greatvast, and I've been periodically updating it. Here is the link if you would like to check it out: www.youtube.com/@greatvast2143

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

    My god, thank you

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

    🥰🥰🥰

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

    And fix so enemies and blue boy can't shoot through chest, keys, doors, trees and walls, please

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

    What about using IDs instead of the Name of the item for the save/load System?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Can do. But basically, we're using the object names as their ID here.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Wait... now I think about it it might be better to simply assign a number (like 0, 1, 2, 3...) to each object as an ID then we can just create a loop and scan the IDs (like scanning indexes), that way we don't need to create the switch and type every single object's name... I'll try this out and see if it works. Thank you for the suggestion!

  • @ultramega4012

    @ultramega4012

    Жыл бұрын

    @@RyiSnow np!

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

    One possible idea to avoid the relative problems of getIObject method is to change the name attribute to a class variable: i.e. to add the static keyword to it and declare it as a subclass variable outside the constructor: So the code can be modified to: case Obj_Axe.name : obj = new OBJ_Axe(gp); break; etc....

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Ah ha, yeah that sounds like a nice & valid alternative indeed. Thank you for the suggestion :D

  • @giorgioripani8469

    @giorgioripani8469

    Жыл бұрын

    @@RyiSnow actually there is still a little mistake with my approach, a valid alternative is to declare and assign ANOTHER static variable baseName inline outside the constructor and then assigning the value inside the subclass constructor name=ClassName.baseName; So that the name variable can remain public and non-stati in the Entity base class 😌 I hope my explanation will result clear ahaga

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Actually, I tried your method with a little arrangement. The only change I did was add final to the name like this: public static final String name = "Woodcutter's Axe"; // As a member variable in the subclass Then it seems to be working fine. I haven't checked it thoroughly yet so I might be missing something though.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    And I think I was missing something... I checked further and now I see what you meant. A static variable in a subclass cannot be referred to when you scan player's inventory. So yeah, creating a static String with a different name (such as name2) and passing it to the name String seems to solve the issue.

  • @giorgioripani8469

    @giorgioripani8469

    Жыл бұрын

    @@RyiSnow perfect!!! I am glad it is working for you!

  • @drefter4
    @drefter46 ай бұрын

    Hello! I wanna say do not ever stop develope Blue Boy Adventure. It is a good game and it can be much more better. It is hard but we all can help you to develope the game togather. Can you make a XP bar and image of Blue Boy head? So we can see the level without pressing C button in the game? That will be cool.

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

    First! And i love your videos!

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

    @RyiSnow Thanks to You I really got into game development and started my KZread learning experience. I used this tutorial as a backbone for early stages of my game and now am working on multiplayer and cryptocurrency API calls to make it a Play to Earn video game. You are a hero! I just started an independent study in game development research at college... Thanks for being my inspiration!

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

    Hello boss. Please based on Android studio, when I right clicked on main, new, I didn't see any activity.

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    This is a desktop game tutorial so Android Studio doesn't work. Check my Android game tutorial series if you're interested.

  • @thepublicviews

    @thepublicviews

    Жыл бұрын

    @@RyiSnow yes, I've been following your android game tutorial, that's why I asked for your help.

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

    /* I FIXED THIS AND FOUND A NEW BUG CHECK THE REPLY*/ Hi Ryi, My game was working perfectly. But today i was making some adjustments. Then I deleted save.dat file by mistake. Now, loading objects is not working although I undo the deleting. I checked my code many times and I tried many things: rebuilding project, recreating project's another copy, delete save.dat and let the program create new one. But Save/Load system is working until Object's Save/Load system. The player's stats, equipments, inventory's Save/Load system working but when i uncomment Object's Save/Load Code Block, i got error. The Line 164 is : gp.obj[mapNum][i].worldX = ds.mapObjectWorldX[mapNum][i]; The Error is : Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.NullPointerException: Cannot assign field "worldX" because "this.gp.obj[mapNum][i]" is null at data.SaveLoad.load(SaveLoad.java:164)

  • @berkayw5781

    @berkayw5781

    Жыл бұрын

    When i was making adjustments i added a bronze coin to map. We didn't declare Bronze Coin in getObject() method. So that's the point. If you kill monster and don't receive the drop, Save/Load system will get NullPointerException. We must add coin, mana, heart's name in getObject() method which is in SaveLoad class. Basicly you can add this lines to getObject() method: case "Bronze Coin": obj = new OBJ_Coin_Bronze(gp);break; case "Heart": obj = new OBJ_Heart(gp);break; case "Mana Crystal": obj = new OBJ_ManaCrystal(gp);break;

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Ah, good catch. I totally forgot those items reappear even after quitting the game. In any case, I'm going to overhaul this object referencing system in the next video since we've found a bug in our trade system that is somehow related to this matter. The update should fix these save/load issues altogether so please stay tuned.

  • @brunohoxha6455

    @brunohoxha6455

    3 ай бұрын

    Did you manage to fix this?

  • @brunohoxha6455

    @brunohoxha6455

    3 ай бұрын

    Nvm, i found the problem