*UPDATE* I recently updated the code so you can open the dialogue window by pressing ENTER alone (right now you need to press a directional key and enter key to open it). I've explained the process at the beginning of Part 23 video (at around a minute and half) so check if you're interested.
@andrasfejes89882 жыл бұрын
part 23?
@poecat88373 жыл бұрын
I really like your way of explaining things. It's so organized and transparent; I've learned a lot. Thank you for your work and I'm looking forward to the next episode.
@RyiSnow3 жыл бұрын
You're welcome and thank you for the encouraging comment!
@UnderArea513 жыл бұрын
Thank you for making these videos! My daughter and I are making her first retro game together. The game looks kinda like - in the ballpark of her Undertale PC game. She's been adding bits of code, making character move around on screen. We have long way to go LOL! I'll keep you posted.
@RyiSnow3 жыл бұрын
Thank you for the follow-up! It's so refreshing to hear others' development story :) I hope you and your daughter will reach the goal!
@nassergh41663 жыл бұрын
thank you for the update!! can't wait to see the finished results!, your methods are creative and I learn a lot from these videos
@RyiSnow3 жыл бұрын
You're welcome! It's still a long way to go... but comments like yours give me power to create more videos. So thank you.
@prizepig2 жыл бұрын
Thanks!
@RyiSnow2 жыл бұрын
Thank you for your kind support!
@UnderArea513 жыл бұрын
Correction: My daughter's game she likes is called "Bear's Restaurant," it's a point and click adventure. I thought it was called Undertale...
@RyiSnow3 жыл бұрын
Bear's Restaurant... sounds interesting! I'd love to play it :P
@RyiSnow3 жыл бұрын
Update: My girlfriend said "So cute! I'd love to visit that restaurant!" lol
@forte22653 жыл бұрын
was looking for this exact thing for my game! very much appreciate this and hope you have a nice end of the year!
@RyiSnow3 жыл бұрын
Thanks and you too!
@drewbeaulieu56874 ай бұрын
I'm running into an issue when my player and npc are facing the same direction, they are getting stuck. If player collides with npc and both player and npc are facing left, instead of colliding, entities get stuck together. Otherwise all other collisions behave as intended. Basically, if I walk in to the back of an npc, or an npc walks into the back of me, both entities get stuck. Anyone else run in to this issue or know of any resolution?
@matildebrandao6377Күн бұрын
Hey! I've just started watching ur tutorial on this and i have been loving it! An ideia, do you think you could teach us to make the dialogue and an image by it side with the character talking but in a more detailed way (pixel art ofc) like in Stardew Valley or Sea of Stars, that would be super cool! Anyways, loved ur content! :>
@jamesconwell27673 жыл бұрын
Loving the series, but cant wait to see what you think of next
@smokeythebear16334 ай бұрын
For some reason I cannot break out of the dialog loop. When I press enter it just restarts the dialog tree again.
@JJSugar224428 күн бұрын
Don't know if you've figured it out by now (I'm assuming you have) but for other people that might be having this issue, double check that you are resetting "enterPressed" back to false in the Player class, interactNPC() method.
@clovercandii3 жыл бұрын
Hello, sorry for bothering! I was wondering if there is a way to be able to open the dialogue screen without pressing a movement key? because if i go over my object, stop moving and press enter, nothing will happen. but then if i click any movement key, even if i click it like 5 minutes later, the dialogue pops up then. it feels a little strange, but i'm not sure if there's a way to change that? thanks again for this in depth tutorial! it's been very fun following along and my project for my friend is looking very nice :)
@RyiSnow3 жыл бұрын
> if i click any movement key, even if i click it like 5 minutes later, the dialogue pops up then. Hmm it seems I cannot reproduce this in my environment. The dialogue pops up only when you press the key in the direction of the NPC. If the window still pops up when you press any other keys as well, check your code. Maybe something is missing or wrong. If you want to open the window without pressing a movement key, add enterPressed == true to the key check if statement then you should be able to open the window by pressing enter alone.
@clovercandii3 жыл бұрын
@@RyiSnow Hello, thank you for replying to my comments! I just got time to try to implement your fixes, sorry for not confirming earlier. The first problem happened because I have a dialogue set to my chest, which has collision off. Implementing the fix to the second part (open the window without pressing a movement key) fixed the first one as well. Hopefully my understanding of " add enterPressed == true to the key check if statement" was correct- I added " || keyH.spacePressed == true" to the update method in my player class. public void update() { if (keyH.upPressed == true || keyH.downPressed == true || keyH.leftPressed == true || keyH.rightPressed == true || keyH.spacePressed == true) { } This worked perfectly except for some reason when I hold space it moves my character extremely slowly in the direction I was already facing for some reason. However, it's very very slight and pretty unnoticeable so I'm okay with it. Thanks again for replying to my comments, I really appreciate it!!
@RyiSnow3 жыл бұрын
No worries and thanks for the follow-up! Yes, your spacePressed implementation is done correctly > when I hold space it moves my character extremely slowly Ah, that's because when you press space key, the program still add the player's speed value to player's worldX/worldY. This is indeed a bug. To fix this, Add: && gp.keyH.spacePressed == false to the collisionOn if statement. This way player's worldX/Y increases only when collision is false and space key is not being pressed. Then move this line: gp.keyH.spacePressed = false; to after the collisionOn if statement. Then it should fix the bug. Thanks for spotting this!
@clovercandii3 жыл бұрын
@@RyiSnow For some reason the reply I posted didn't post and I just noticed now. Thanks for answering! I tried your fix and it didn't work for some reason and I'm not sure why, so I did this instead: if (!collisionOn && keyH.spacePressed == false && (keyH.upPressed || keyH.downPressed || keyH.leftPressed || keyH.rightPressed)) { switch (direction) { case "up" -> worldY -= speed; case "down" -> worldY += speed; case "left" -> worldX -= speed; case "right" -> worldX += speed; } } and added this to the sprite if statements: if (keyH.upPressed || keyH.downPressed || keyH.leftPressed || keyH.rightPressed) { spriteCounter++; if(spriteCounter < 24) { spriteNum = 1; } if(spriteCounter > 24 && spriteCounter < 48) { spriteNum = 2; } if(spriteCounter > 48) { spriteCounter = 0; } } and that worked okay. does that work? is there anything that could be done simpler that i should do? Thank you!
@RyiSnow3 жыл бұрын
@@clovercandii Hmm ok actually I'm trying to make an update video to address these issues so pls wait for the video and if the solution in the video still didn't work, let me know.
@anjalbamanu1641 Жыл бұрын
When i pressed enter key all other player movements are not working??
@Cattix2 жыл бұрын
@RyiSnow I have a quesstion would it be possible to read the dialogues form a text file just like we did with the map?
@RyiSnow2 жыл бұрын
Yes, it is possible. You can read a file and put them in an array.
@OneLatteComingRightUp Жыл бұрын
I love all your tutorials, but I have a suggestion for this one, is there a way where we could reply to the dialogues? And is there a way to let other NPCs move except for the one you are interacting with? Thanks!
@soratachibana35722 жыл бұрын
Hi Ryi nice video but I have a problem, everytime I collide with the NPC from left or right we will both get stuck. this also happens with the door from the objects. It's just left and right, up and down is just fine any Idea how to fix this? also thank you for the best tutorial!
@soratachibana35722 жыл бұрын
omg Im so stupid, I must have clicked something that made the "entity.solidArea.y -= entity.speed;" go after the break;
@LeighFlies2 жыл бұрын
RyiSnow is this any good for the speak() method? I wanted to make it so it will pick a random dialogue every time but not repeat them until it's used them all, and to be flexible for different NPCs with different numbers of dialogues set. I only have one NPC in my game at the moment , and my main worry is that when I add another, they will end up sharing the same list which will screw it up, and I don't know how to refactor it to avoid that... I'm a beginner but it seems to work for now though and I wanted this feature, and in the future I want to add to this method by setting a flag if the dialogue is related to the game progression, which will override this stuff with actual important dialogues. For now though, what do you think? Really enjoying your course, thanks so much :) ArrayList usedDialogues = new ArrayList(); //this is defined at the top of the class to stop the second while condition always returning false... public void speak() { //GENERAL CHARACTER SPEAK BEHAVIOUR Random rand = new Random(); int dialogueCount = 0; for (int i = 0; i < dialogues.length; i++) { if (!(dialogues[i] == null)) { dialogueCount++; } } int randomValue = rand.nextInt(dialogues.length); //init only; while (dialogues[randomValue] == null || usedDialogues.contains(randomValue)) { randomValue = rand.nextInt(dialogueCount); if (usedDialogues.size() >= dialogueCount) { usedDialogues.clear(); // cycle round when used all dialogues } } gp.ui.currentDialogue = dialogues[randomValue]; usedDialogues.add(randomValue); switch (gp.player.direction) { case "up" -> direction = "down"; case "down" -> direction = "up"; case "left" -> direction = "right"; case "right" -> direction = "left"; } }
@kimabram Жыл бұрын
I'm having a problem. When I'm talking to my npc in up direction it says error. I check all my direction up related things but I don't see any problem.
@anthonytrovarelli21597 ай бұрын
for some reason when I move my character using the w and d key it activates the window and i dont know how to fix it
@nickrogers521511 ай бұрын
Hi, I have some problems with my game Screen using vscode. Sometimes when I move the character around, there would be some black bars flashing on the screen. When I move horizontally, the black bars are vertical, and when I move vertically, the black bars are horizontal. I've had this problem ever since I was using the small map, but it was rare. Now, I get this problem way more using the bigger map. And also, when I run the code and then try to talk to the NPC for the first time, the code will take about 2-3 seconds before the dialogue box shows up. Afterwards, when I try to talk again, the box would show up immediately.
@Merkuse2 жыл бұрын
Tip for guide followers: Don't mix "/n" and " " up. "/n" - wrong " " - right
@the_not_so_great_unknown217021 күн бұрын
is still not recognize in mine:(
@vaughnscott5112 жыл бұрын
great tutorial. I have a suggestion that helped me alot. If you have a name id on your npc, say a string names old man, when you are in your loop to check for entity collisions, you can do a e.name_id comparison, add a boolean ad a counter just for debounce and it makes npc interactions alot easier. thank you!! I would not have figured that out if not for your teachings..
@RyiSnow2 жыл бұрын
Sounds interesting. Could you paste your loop code here?
@TerminallyUnique953 жыл бұрын
28:55 You knew I was going to ask haha.
@RyiSnow3 жыл бұрын
:P
@harisclientisskidded2 жыл бұрын
Hey RyiSnow, when i walk to an NPC and get the text, the NPC is still moving, could you help me?
@BrunoHenrique-oe5hbАй бұрын
Im with the same issue. Did you discovered how to solve it?
@harisclientisskiddedАй бұрын
@@BrunoHenrique-oe5hb Well that was a long time ago, i might have..
@sorcerian_bootleg71123 жыл бұрын
Awesome! Looking forward for your next video! I wonder if you will make the text appear character by character.
@RyiSnow3 жыл бұрын
I actually created that version too but since this dialogue video was becoming a way longer than I expected so I decided to cut it. It's always difficult to take this content - video length balance haha. Maybe I'll include it in another extra video :)
@panagiotiskougioumtzidis91143 жыл бұрын
Keep doing this amazing job!!!
@sainmadrigal58522 жыл бұрын
Hello RyiSnow, Im having problems with the g2.setStroke(new BasicStroke(5)); I keep getting the error message: The type java.awt.Stroke cannot be resolved. It is indirectly referenced from required type java.awt.BasicStroke The method setStroke(Stroke) from the type Graphics2D refers to the missing type Stroke. Can You please help me?
@benjamenmichael54542 жыл бұрын
Did you include the line "import java.awt.BasicStroke;" ?
@clovercandii3 жыл бұрын
Hi, I am having a few issues with my npc. Sometimes both the player and the npc "blink" when they collide and one time they disappeared completely until I pressed a movement key. Also, the npc can walk through me and the top half of trees when approaching from the side, which is strange. do you know why that happens?
@RyiSnow3 жыл бұрын
Oops, sorry I think that's because player's y and npc's y are equal so the draw methods didn't get called. Add an equal sign to one of those conditions (either way is fine) then the bug should disappear. I will update my post. Thanks for spotting this.
@beardiegames0147 ай бұрын
Cannot read field “ui” because this.gp is null, for me I didn’t add this.gp = gp to the NPC_OldMan class because of that it was giving me that error message. I figured it out and I’m happy to not delete the project and beat my head against the wall. I’m happy now!
@dusklycanrocvlogs2 жыл бұрын
Hey RyiSnow! How can we make it so that instead of having the dialogue appear one line, then no dialogue and then pressing enter again for the next line of dialogue, we have just continuous dialogue until all lines of dialogue have been said and pressing enter to automatically cycle through each index of the dialogues array so that the dialogue box stays with each new line of dialogue instead of having it appear and then disappear and reappear again when enter is pressed?
@RyiSnow2 жыл бұрын
It's a little complicated process so I can't really explain it in a comment. Since I've received similar questions from others as well, I will make a video about an advanced dialogue system that features a page-flipping mechanism.
@lostparlour2 жыл бұрын
hi, nice video i wonder if adding an individual character image on the dialogue box is possible? i cannot seem to find a way.. thank you
@hillclimbracingcenter10 ай бұрын
it is! first, create a BufferedImage type in UI class. Then from Player class in interactNPC method set the BufferedImage from ui to gp.npc[i].down1. Now you can access & draw the character image in UI class! :)
@cedricsahaghian1605 Жыл бұрын
Thanks for your work!
@lamekhgt52443 жыл бұрын
Thank you for making these videos! but i have a problem with my program. So when i tried to approach the npc and pressed enter, sometimes the dialogue pops up but sometime not. i wonder whats wrong ?
@RyiSnow3 жыл бұрын
Maybe you pressed the enter when NPC collision is not happening?
@Cattix2 жыл бұрын
@@RyiSnow i hand the same problem but i figured out that it only pops up if you press an other key at the same time. Also if i press enter first then wait a few secons and press another key the dialogue instantly pops up pls help i would really apreciate it! Thanks
@minhucreview86473 жыл бұрын
tks for making these videos.It is very useful.I don't know how this game can be played in multiplayer mode at the same time.Can u make a video tutorial for this?
@El_duhammer2 жыл бұрын
Great videos! I however am experiencing an issue. Whenever I attempt to speak to an NPC for the first time, the game draws an empty dialogue box. Then when I press (Enter) again, it pulls up the first line of dialogue in the dialogue box. Then if I press (Enter) again, it brings up the first dialog first, then the next dialogue and repeats this until it pulls up an empty box again then repeats the cycle. I've been staring at the code for hours looking for the issue but can't seem to locate it. Any tips?
@El_duhammer2 жыл бұрын
Disregard, I fixed this issue!
@benjamenmichael54542 жыл бұрын
@@El_duhammer How? I am getting the same issue
@tomatosoup17592 жыл бұрын
Great video, as always! However, I did notice I have a slight issue. When I hit enter to speak with the NPC, it only goes into dialogue mode if I am either pressing a movement key when I hit it or right after I hit it (basically, I have to be moving to interact with him, and if I don't, it still interacts the next time I do move). I know this has something to do with my input system. It's a modified version of the system you provided in the comments of one of the extra videos, where an ArrayList is used. Do you have any ideas on how to fix this?
@RyiSnow2 жыл бұрын
Yeah, that was a known issue and I think I provided a fix in one of the later videos!
@tomatosoup17592 жыл бұрын
@@RyiSnow That's good to know. I managed to fix the issue where hitting any key after enter started dialogue, but the movement thing threw me for a loop. Thanks for letting me know, and keep up the great work!
@rafaelastolfo Жыл бұрын
@@tomatosoup1759 Hi, I have the same problem, do you know which video it fixes? or better haha did he fix it?
@tomatosoup1759 Жыл бұрын
@@rafaelastolfo I think it’s only a couple videos later, I don’t remember which one but I know he fixed it not long after this one
@rafaelastolfo Жыл бұрын
@@tomatosoup1759 he replied right down here, now I've managed to fix it, thanks for answering me but tell me, are you done with your adventure?
@ParalyticAngel10 ай бұрын
28:30 Just remove the speak() in the subclass and everything is fine.^^ But I don't know if you have planned to add something special to that subclass speak() method. Ah, I see, exactly what you are talking from little later.^^ 😉😉😉😉😉😉
@droidlycodes2 жыл бұрын
Where can I send money to you?
@prizepig2 жыл бұрын
Ugh. I dont know what I am doing wrong here... I have retyped this code 4x now and I get the same error when trying to open the dialog text: Exception in thread "Thread-0" java.lang.NullPointerException: Cannot invoke "entity.Entity.speak()" because "this.gp.npc[i]" is null This is the location that causes the error and if I comment this line out, the dialog opens just fine (no text of course) public void interactNPC(int i) { if (i != 999) { gp.gameState = gp.dialogueState; gp.npc[i].speak(); } } Is there any way you can post the source code to your google drive so I can check my code against yours without having to start the entire lesson over again?
@RyiSnow2 жыл бұрын
You get NullPointerException error when the program cannot find the targeted object. In this case, it's saying this.gp.npc[i] is empty (null). You can use this information as a clue to track down the cause. Here's how to track it down: 1. Check what index is returning null Type: "System.out.println("npc index:" + i);", right before the line which returns the error. Like this: if (i != 999) { gp.gameState = gp.dialogueState; System.out.println("npc index:" + i); // insert here gp.npc[i].speak(); } Run the program and reproduce the error. You'll get the index on the console. Probably multiple lines and the last one is causing the error. If you've only placed 1 NPC (in index 0), then I think it returns 1 or a higher index. This means the program is trying to read an empty object in the array and saying "I can't read this because it is empty". My guess is, that something is wrong with the checkEntity method in the CollisionChecker. 2. Check the checkEntity method Check the target scanning loop and make sure it is constructed not to read a null object. Like this: for(int i = 0; i < target.length; i++) { if(target[i] != null) { // Check if you have this condition. This prevents it to read null objects // Get entity's solid area position entity.solidArea.x = entity.worldX + entity.solidArea.x; entity.solidArea.y = entity.worldY + entity.solidArea.y; etc, etc... } } If you still couldn't fix it after doing these steps, let me know again!
@prizepig2 жыл бұрын
@@RyiSnow Wow, i didnt expect such a personalized response. I just made another attempt starting at the beginning of this video and again I am able to get up to the point where I add the dialogue text and i get the NullPointerException again. I added the System.out.println("npc index:" + i); to the Player class interactNPC(int i) method and it returns 'npc index:1' but then immediately fails on the gp.npc[i].speak() part. If I comment out that line of code the dialog box comes up with no text but no error either. I also checked the CollisionChecker class checkEntity(Entity entity, Entity[] target) method and it does have the correct IF statement 'if (target[i] != null). I'm not sure what else to try. I dont know why my npc[i] is 1 but the old man is npc[0]. Any further troubleshooting/guidance you can offer is greatly appreciated.
@prizepig2 жыл бұрын
Also, i just tried to add i=0 to the interactNPC() method and the dialog works fine. So it seems like my npc[i] being set to 1 is the problem but I dont know why it's being set to 1. this is obviously not usable but it helps narrow down the issue. public void interactNPC(int i) { if (i != 999) { gp.gameState = gp.diaglogState; System.out.println("npc index:" + i); i = 0; gp.npc[i].speak(); } }
@RyiSnow2 жыл бұрын
You can also try inserting the following three lines to narrow down the scope: for(int i = 0; i < target.length; i++) { System.out.println("current index in the loop:" + i); // Insert here if(target[i] != null) { System.out.println("currently checking index:" + i); // Insert here // Get entity's solid area position entity.solidArea.x = entity.worldX + entity.solidArea.x; entity.solidArea.y = entity.worldY + entity.solidArea.y; etc, etc... } } System.out.println("returning index:" + index); // Insert here return index; Apparently, the checkEntity method is returning [1] to the interactNPC method and there should be a reason for that.
@prizepig2 жыл бұрын
@@RyiSnow I GOT IT!! The problem was in my checkEntity method i had index = 1; but I needed index = i. Thanks again for taking the time to help me troubleshoot this.
@nadinewalter-lang93338 ай бұрын
Nice tutorial!
@vampybitesss Жыл бұрын
lol beware * is a special token or something, because it cannot be used to split lines
@ganbarimasu94463 жыл бұрын
I cannot see the dialogue screen even though it's being created. It is the same with pause option. I can pause the game with P key, but cannot see the 'PAUSE' text on screen. Any idea how do I fix it or what am I missing here? Do we have a code that turns on the visibility? And thanks for the videos as always. You're great:) Also, I can interact with the NPC only only while pressing another button like w,a,s,d alongside enter. Is this how it is supposed to be?
@RyiSnow3 жыл бұрын
Can't say for sure without seeing your code but if the texts are indeed processed and drawn in the program, likely cause would be: 1. Some objects are rendered after the texts and hide them. Check if ui.draw(g2) is being called after all other objects. 2. g2 was somehow disposed before rendering UI text. 3. If you have tweaked Graphics2D's alpha, check if you have reset the value correctly. About the key combination for opening dialogue window, I fixed it in Part 23 so you can start conversation by pressing Enter alone.
@ganbarimasu94463 жыл бұрын
@@RyiSnow how do I do the third step you've typed above. By the way, I can see the draw time on the screen but cannot see pause text, opening screen or dialogue screen. The difference I can see is drawTime is a part of play State while the others are from different states. I've watched your previous videos many times and compared to my code but they seem the same. I am stuck and cannot continue to this series so I am sad :( note: I can paste my code if necessary. note2: I just tries I can control title screen and even close the game using keys. So the problem isn't exactly a coding mistake, but a problem with printing on screen. I checked whether it is being written in the background because pf the priority of the upper code lines but couldn't see anything..
@RyiSnow3 жыл бұрын
Try commenting out tileM.draw, obj.draw, npc.draw and player.draw. Start the game and check if you can see the title text or Pause text. When things like this happen, try bypassing/disabling the functions one by one and make the code as barebone as possible. If the issue stops, try reclaiming the disabled functions one by one while checking if the code runs correctly every time you reclaim a new function or lines of code. Eventually you reach the point when the issue starts and that's where you can find the cause. You're struggling to find it out because a lot of elements have been implemented into the code and makes it harder to track. But if you do this kind of back tracking, finding the problem is often not so difficult. Also, don't worry about the alpha if you have no idea what that is. It's something I introduced in later videos.
@ganbarimasu94463 жыл бұрын
@@RyiSnow I commented them out first one by one then together but the screen was still just plain black. The confusing part is I was still able to close the window by using the 'Quit' option we added on the next video but still I was unable to see anything:( Is it possible for you to share your GamePanel and UI classes. If I compare them, I may find the problem (it's fine even if your code is more developed than my current code) If I had time, I could check all the previous videos but I have upcoming final exams so it's not and probably will not be possible for quite a while:(
@RyiSnow3 жыл бұрын
Can I see your GamePanel and UI class? You can paste them here.
@holmdev3 жыл бұрын
nice update If I have to come up with a proposal, why not fix it so you can press another key, then you scroll further in the dialog window, so you do not have to go in and out all the time.
@RyiSnow3 жыл бұрын
I just gave him some variations since usually an NPC has several dialogue variations. It's no fun if an NPC has only 1 dialogue, isn't it?
@holmdev3 жыл бұрын
@@RyiSnow Now I understand why you did so .. smart
@holmdev3 жыл бұрын
156 / 5000 I have a small bug that I try to solve and it is that it sometimes locks when you talk to npc, I get nowhere. But I will solve it.
@daniclo4 Жыл бұрын
Hello Ryi I've been following these videos as my first contact with video game making, and trying to implement new things by my own. After I managed dialogues to work correctly, I started to (only from time to time, not everytime I run the game) get this weird error where, when graphics2D.drawString method is called I get a ClassCastException for "trying to cast sun.java2d.NullSurfaceData to sun.java2d.d3d.D3DSurfaceData. These, I assume, are classes working in the background when you work with graphics2D class. This is what I get: Exception in thread "Thread-0" java.lang.ClassCastException: class sun.java2d.NullSurfaceData cannot be cast to class sun.java2d.d3d.D3DSurfaceData (sun.java2d.NullSurfaceData and sun.java2d.d3d.D3DSurfaceData are in module java.desktop of loader 'bootstrap') at java.desktop/sun.java2d.d3d.D3DTextRenderer.validateContext(D3DTextRenderer.java:51) at java.desktop/sun.java2d.pipe.BufferedTextPipe.drawGlyphList(BufferedTextPipe.java:95) at java.desktop/sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:71) at java.desktop/sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2932) at Main.UserInterface.dibujarVentanaDialogo(UserInterface.java:75) at Main.GamePanel.actualizar(GamePanel.java:153) at Main.GamePanel.run(GamePanel.java:97) I have really no idea of how to work around this and I have not found any useful info by searching. If you can help me I would really appreciate it. Thank you beforehand.
@razzubi3 жыл бұрын
A combat system would be cool
@RyiSnow3 жыл бұрын
I've laid out the roadmap in Part 13 so check that if you're wondering what will be coming.
@razzubi3 жыл бұрын
@@RyiSnow oh okay thanks for the cool content !
@kevincolgan66513 жыл бұрын
Great keep it up!
@Clipaholick3 жыл бұрын
amazing!
@MrLoser-ks2xn Жыл бұрын
🥰🥰🥰
@matopulos5146 Жыл бұрын
Hello Great Video!! Maybe Someone can help me: I'm at 14:26 and everything works fine. But when i set gp.ui.currentDialogue = dialogues[0]; in the speak() Method, the game seems to crash when i interact with the npc. Even the Dialogwindow isnt showing anymore. Does anyone had the same problem?
@matopulos5146 Жыл бұрын
Edit: The game is not really crashing, because the music just keeps playing. So iI guess im just trapped in the dialogueState without a Dialogue window
@x.x.x4576 Жыл бұрын
Automatic line spitting, if someone does not want to insert " " in correct spot every time. public void drawDialogueScreen() { int x = gp.tileSize/2; int y = (int) (gp.screenHeight-4.5*gp.tileSize); int width = gp.screenWidth-gp.tileSize; int height = 4*gp.tileSize; drawSubWindow(x, y, width, height); g2.setFont(g2.getFont().deriveFont(Font.PLAIN, 30F)); x += gp.tileSize; y += gp.tileSize; //AUTOMATICALLY SPLIT DIALOGUE BASED ON CHARACTER LIMIT int characterLimit = 30; int characterCount = 0; StringBuilder line = new StringBuilder(); for(String word : currentDialogue.split(" ")) { characterCount += word.length(); if(characterCount < characterLimit){ line.append(word).append(" "); } else if(characterCount!=characterLimit) { g2.drawString(line.toString(), x, y); y += 38; characterCount = word.length(); line = new StringBuilder(word + " "); } else { line.append(word).append(" "); g2.drawString(line.toString(), x, y); y += 38; characterCount = 0; line = new StringBuilder(); } } if(!line.equals(new StringBuilder())) { g2.drawString(line.toString(), x, y); } }
@benvandonkelaar49643 жыл бұрын
Love the videos, keep up the good work! Just a question, I am trying to make my dialogue change when you push the "N" key, but I get an error saying "(EventQueue.java:746)". this is my code; else if(gp.gameState == gp.dialogueState) { if(code == KeyEvent.VK_N) { entity.dialogueIndex ++; } can you help me solve the problem? thanks!
@RyiSnow3 жыл бұрын
I don't know how you've changed the rest of your code so I'm not sure what the problem is. But basically you need something like this to change dialogues by pressing a key (I used Enter in this example): [KeyHandler] else if(gp.gameState == gp.dialogueState) { if(code == KeyEvent.VK_ENTER) { //gp.gameState = gp.playState; // remove this enterPressed = true; // add this } } [GamePanel / update] // add this if(gameState == dialogueState) { player.update(); } [Player / interactNPC] if(i != 999) { if(gp.keyH.enterPressed == true) { if(gp.gameState == gp.playState) { gp.gameState = gp.dialogueState; gp.npc[i].speak(); } else if(gp.gameState == gp.dialogueState) { if(gp.npc[i].dialogues[gp.npc[i].dialogueIndex] != null) { gp.npc[i].speak(); } else { gp.npc[i].dialogueIndex = 0; gp.gameState = gp.playState; } } } } gp.keyH.enterPressed = false; [Entity / speak] // remove this //if(dialogues[dialogueIndex] == null) { // dialogueIndex = 0; //} It's a pretty rough sketch but this way, the dialogue changes every time you press enter key and if the npc has no more dialogue, the dialogue window closes.
@benvandonkelaar49643 жыл бұрын
@@RyiSnow Thanks a lot!! it did not work at first, but I eventually got it working. thanks for the help and keep up the great work! love the videos
@carl48393 жыл бұрын
@@RyiSnow I tried this and it only works if the player is holding down a key(like "A") , walking into the npc and not letting go, if I let go for example "A" in the dialogue, it freezes and I cant press enter to continue the dialogue. any advice? edit: I just realized that anytime a dialogue is happening, if I let go of a movement key, for example "A" everything just freezes, and I have to quit the game, if that makes things clearer. edit2: btw, I can still move in a certain direction while talking to the npc. For example, if I walk left into the npc, start talking and not letting go of "A", the player still moves, but when I release "A", I can't walk anymore(still in dialogue). I don't know if this helps, but any help is very appreciated. Also thanks for the tutorials, I love them
@MasonJarFilm2 жыл бұрын
@@carl4839 i have the same problem as you, have you fixed it?
@carl48392 жыл бұрын
@@MasonJarFilm Nah. Gave up on that project a while ago. Sorry.
@dev_kesse2 жыл бұрын
I made a very simple change to our speak method as I really like the feel of the NPC essentially telling me to go away by just repeating their last line instead of cycling through previous dialogues. I'm a complete noob and I was very proud of myself. There is probably a better way, but this works for anyone who is interested. public void speak() { if(dialogues[dialogueIndex] != null) { gp.ui.currentDialogue = dialogues[dialogueIndex]; dialogueIndex++; } else { gp.ui.currentDialogue = dialogues[dialogueIndex-1]; }