Dungeon Puzzle/Gimmick - How to Make a 2D Game in Java #53
In this video, we add a pickaxe so you can break some walls and also implement a simple dungeon rock puzzle in which you push and move rocks and place them on metal plate switches.
If you want to use my assets (images/maps/sound) that are used in this tutorial, here's the link:
drive.google.com/drive/folder...
Guidelines for using Blue Boy Adventure's code and assets:
docs.google.com/document/d/1q...
Timestamps:
0:00 Introduction
0:35 Adding New Resource Files
2:20 Adding the Pickaxe
5:18 Adding the Destructible Wall
8:54 Getting an Item by Breaking the Wall
10:17 Adding the Iron Door
11:19 Adding the Metal Plate
13:12 Adding the Big Rock
15:15 Placing Objects
17:53 Pushing and Moving Objects
20:47 Detecting the Rock on the Plate
32:58 Testing the Puzzle
#javagamedevelopment #javatutorial #2dactionrpg
Пікірлер: 53
I hope you never stop this series. You've basically built your own game engine and its becoming easier to add more content and scale this game into something big. All you really need now is a graphics designer to keep making new tiles/characters so you can just focus on adding content :)
@RyiSnow
Жыл бұрын
That is true but this is a 2D programming tutorial and not a devlog so I think I should focus on the technical aspect since many people are more interested in learning something new in technical than watching some footage of just adding new characters/tiles by using the existing methods. I've been trying to implement at least something technically new in every video and now the base system is pretty much complete so I think it's about time to end this ;) That said, since I've come this far, I'm thinking to keep developing this Blue Boy Adventure privately and hopefully turning it into a full-fledged game (with a larger map and more items, etc.) so I can upload it on itch or somewhere.
@dumdum7099
Жыл бұрын
@@RyiSnow I hope you know how much you have helped other people with this series. Thank you very much sir.
@pulkstenis1
Жыл бұрын
@@RyiSnow if you plan on starting another series of a new game after this, what do you think about extracting the core game engine code from Blue Boy and use that as a head start for your next project?
8:30 instead of setting the wall's destroyed form to null, I decided I wanted some rubble to appear on the ground when the player breaks a wall with the pickaxe. However, it can look kind of weird/unnatural to have the same rubble design show up on every tile, so I added two more rubble images and set IT_Rubble's tile image to be randomly assigned one of those three images. The IT_Rubble class looks identical to IT_Trunk, except instead of down1 = setup("/tile_interactive/trunk", gp.tileSize, gp.tileSize); That down1 image is instead determined by: Random random = new Random(); int i = random.nextInt(100)+1; if (i 33 && i 66 && i
hey man i just recently discovered your channel while searching for some 2d game development tutorial and i dont regret it , i have learnt a lot from this series but still have a long way to go....so yeah thanks for posting these you are doing an amazing job.
i love how much effort you put into this, im learning to code and you're helping alot
Damn man I was thinking on this same concept saying I'm sure you gonna implement this next and there you go I remember playing golden sun game and solving all the puzzles from the elemental light houses and rocks and here you are showing us bravo to you my good friend, youre truly a blessing
the way you think to create a code or solve a problem is simply genius, I never think about these things hehe. Thanks for the amazing video!😆
Hi I am actually still in #13 but I came here to tell you that you are amazing and because of you I am able to make a 2d game using your vidoes as a reference. Please never stop doing these videos 🙏🏻 and I hope you have a nice day.
I am SO glad you are making this, I cant wait to start from the begining. Subbed!
@RyiSnow
Жыл бұрын
Thank you!
please keep on making this valuable series. Next days i will start with this tutorial from #1 . Thanks for this work you made.
@RyiSnow
Жыл бұрын
This series will end soon but you have at least 50+ videos to go :P
Loving the series! I'm glad to see it's still going strong! Any chance at possibly, a simple multiplayer support tutorial in the future so I can run around with friends? lol
Incredible Ryi, as always!!
your videos are amazing! thank you so much for this.. what a great teacher!!!
Thank you for your new video. Thank you so much.
Truly amazing concepts, you introduced here! The possibilities to expand the game in a meaningful way are so big! I am looking forward to implement these mechanics into my game. Thank you for this new video, it just is so much fun to work on my own game thanks to you! Even my profile picture is my avatar I made for my game XD However, I do have a question independently form the video. How would you give effects to entities (the player) when you're on certain tiles? Something like that you are slower and get damage when you are on lava or that you are invisible when you are on a bush tile. In addition to that I wanted to ask how one could implement animated tiles, like for water and lave? I hope you haven't covered these topics in an existing video yet and I just somehow missed them.
I'm loving this series so much! I actually started working on my own version which is pretty similar but uses a "click to walk" feature where it calculates the shortest path from where my character is standing to where I clicked. I'm having a slight issue with diagonal collision since it checks the top left pixel of the player. You don't happen to have a Discord server do you?
Thanks!
I’m only 5 episodes away.. can’t wait
A quest system would be a great addition! I'm on episode 13 right now.
This is the first thanks to my awesome Java Game teacher! I've been making this with Android & you're very easy to understand! I have a big question however, bigger maps render extremely slow. I took a Minecraft approach in my brain to render sections of the world in chunks sort of like how old Zelda/Pokemon GBC games render as well or mostly any game really. When I start rendering 100x100 tiled worlds my devices slow right down so there needs to be some sort of "Show only the area the player can see + extra border" of the tiles being drawn. I've been working on this for over a week trying different methods & thought maybe you could teach me your ways! Thanks again for sharing this game, I can't wait to play your version of it! When done you should do a contest for those that have followed this to see who has the best game made based on your guide :) just a thought!
@RyiSnow
Жыл бұрын
Thank you for your kind support. As for rendering a large map, rendering 100x100 tiles at once surely slows the game down. I'd recommend you check the part 5 video in which I implemented a function so the camera only draws the tiles within the camera frame. With the function, the map size really doesn't matter in terms of performance. I tested it with a 1000x1000 map and the performance didn't drop down at all.
@misterdneh
Жыл бұрын
@@RyiSnow hey thank you, I'm watching your series from the start again because I may have changed something along the way (I sometimes go 10 steps ahead) so rendering could be cause by this! I hope you share this on Steam when done I'll be your first buyer as long as it's not $79.99 CAD of course 😉 games are so much anymore 🤑
Ryi, I'm impressed once again. The only regret is that the series is coming to an end, for my part, I would just like to ask you to consider adding quests and dialogue options. For the next series you could consider a simple citybuilder, this is missing from programming, especially java :)
@Rejuvenatelol
Жыл бұрын
quests and dialogue options would be so cool!
Hello, great series i'm learning tons from this :D simple question, what happens if i need to use the plates and rocks elsewhere in the game, duplicates the Objects or check a condition on the zone before adding puzzle mechanic ?
NICE!
Hey RyiSnow, I'm just wondering if you have thought about doing a full tour of the game, to showcase everything you have made. I would love it if you did, because it has come so far.
@RyiSnow
Жыл бұрын
Actually I have. I'm thinking to make a Let's Play Blue Boy Adventure video after the series is done so I play the game from the beginning while talking about my thoughts on the series.
Which Programs I Need To Install
Hi Ryi! I did same things in the video. But the big rock is looking kinda jittering when i push it. Do you have any idea for why this is happening?
@berkayw5781
Жыл бұрын
And i wanna ask you something for end of the series. Will you add how to import game as a jar file? Cuz i watched your “how to import your game as a jar file” and more tutorials about that issue. I tried with Eclipse and also Intellij. The jar is not opening by double clicking. When i tried open it from cmd, it gives error about config. Finally i really excited for the end. Thank you for your all work!
@RyiSnow
Жыл бұрын
You need a config file to run the jar so place the file in the folder where the jar is. I'm not so sure about the cause of the jittering but it's happening to me too.
@berkayw5781
Жыл бұрын
@RyiSnow Thanks, it worked! Then i found a small bug. If you open a chest then save your game. When you load the game again if you try to interact with the chest, the chest's dialogue doesn't show up. For solution, basically i created setDialogue() super class in Entity. Then in SaveLoad class i added this line to Load() -> Objects on map's for loop-> else section: gp.obj[mapNum][i].setDialogue(); // added this line (I'm not sure if it's good solution.)
@RyiSnow
Жыл бұрын
Oh, that's right. We're not calling the setDialogue from the constructor so the array becomes empty when loaded. I think the easiest fix would be: (SaveLoad class) Change : gp.obj[mapNum][i].loot = gp.eGenerator.getObject(ds.mapObjectLootNames[mapNum][i]); To: gp.obj[mapNum][i].setLoot(gp.eGenerator.getObject(ds.mapObjectLootNames[mapNum][i])); Thanks for spotting this!
@juandebenedetti2884
Жыл бұрын
Hi guys, were you able to fix the jittering that occurs when moving the rock?
Hello Ryi. To avoid the nullPointerException for the absence of names in interactiveTiles you could have use the function instanceof from the built-in Java SE. for example: if (gp.iTiles[gp.currentMap][i] != null && gp.iTiles[gp.currentMap][i] instanceof MetalPlate metalPlate) { plateList.add(metalPlate); }
@RyiSnow
Жыл бұрын
Ah, indeed that looks like a better way to handle it. That said I don't think you need to name the instance. You can just type: if(gp.iTile[gp.currentMap][i] != null && gp.iTile[gp.currentMap][i]instanceof IT_MetalPlate) { plateList.add(gp.iTile[gp.currentMap][i]); } Thank you for sharing your method!
hi! i don't now what is the problem i implements the saveLoad class but if i have load the game and try to show the Msg in chest i was haveing the same bug like merchant bug
@RyiSnow
Жыл бұрын
Yes that's a bug and I'm going to address it in my next video. Sorry for the confusion!
@charefdz
Жыл бұрын
@@RyiSnow thanks man
@charefdz
Жыл бұрын
@@RyiSnow maybe the bug in title dialogue
@RyiSnow
Жыл бұрын
@@charefdz It's just because the dialogue array in the chest was empty. Anyway it is already fixed so stay tuned.
Do you already know what your next project is?
@RyiSnow
Жыл бұрын
I have several projects (small ones and big ones) in mind but haven't decided to choose which one yet. Most likely do some smaller game projects first since I'm a bit exhausted from this year-long series!
First
Helló whats your dc name and #?
Hello RyiSnow, I think I found a bug where if two rocks collided, both rocks will pass through each other. Here's my code just in case I may have messed up: //Player Class public void interactObject(int i){ if (i != 999) { //obtain items if (gp.obj[gp.currentMap][i].objectType == obtainable) { if (inventory.size() != maxInventorySize && gp.keyH.enterPressed) { if (canObtainItem(gp.obj[gp.currentMap][i])) { gp.obj[gp.currentMap][i].setInventoryIcon(); gp.obj[gp.currentMap][i] = null; } } } //interact objects with requirements else if (gp.obj[gp.currentMap][i].objectType == interactable && gp.keyH.enterPressed) { gp.obj[gp.currentMap][i].interact(); if (gp.obj[gp.currentMap][i].name.equals("Papers")) { gp.obj[gp.currentMap][i] = null; } } else if (gp.obj[gp.currentMap][i].objectType == movable){ gp.obj[gp.currentMap][i].move(direction); } } } //Entity Class public void checkCollision(){ collisionOn = false; gp.cChecker.checkTile(this); gp.cChecker.checkObject(this, false); gp.cChecker.checkEntity(this, gp.npc); boolean contactPlayer = gp.cChecker.checkPlayer(this); } //NPC Class public void move(String d){ this.direction = d; checkCollision(); if (!collisionOn) { switch (direction) { case "up": worldY -= speed; break; case "down": worldY += speed; break; case "left": worldX -= speed; break; case "right": worldX += speed; break; } } else{//Prevent player from overlapping with Movable objects (this bug) if (gp.keyH.shiftPressed) { switch (gp.player.direction) { case "up": gp.player.worldY += gp.player.speed + gp.player.addSpeed; break; case "down": gp.player.worldY -= gp.player.speed + gp.player.addSpeed; break; case "left": gp.player.worldX += gp.player.speed + gp.player.addSpeed; break; case "right": gp.player.worldX -= gp.player.speed + gp.player.addSpeed; break; } } else{ switch (gp.player.direction) { case "up": gp.player.worldY += gp.player.speed; break; case "down": gp.player.worldY -= gp.player.speed; break; case "left": gp.player.worldX += gp.player.speed; break; case "right": gp.player.worldX -= gp.player.speed; break; } } } }
Hello @RyiSnow I am following the part of Pushing and Moving objects on 17:54 video, I done what you showed me but I have error message : For example, I am trying to open Treasure chest for get a key or selecting something from an inventory and I get this message Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 999 out of bounds for length 100 at entity.Player.interactNPC(Player.java:492) at entity.Player.update(Player.java:289) at main.GamePanel.update(GamePanel.java:202) at main.GamePanel.run(GamePanel.java:184) at java.base/java.lang.Thread.run(Thread.java:1583) Can you or anyone help me please?
@RyiSnow
5 ай бұрын
What's written in line 492 of your code?