Guard and Parry - How to Make a 2D Game in Java #49

In this video, we implement a guard and parry (just guard) system so we can stagger the attacker and give extra damage!
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...
Thanks for watching.
Timestamps:
0:00 Switching Guard On/Off
6:49 Blocking Monster's Attack
11:59 Disabling the Transparent Effect
13:41 Adding Knockback Effect to Monster's Attack
16:43 Implementing the Parry System
25:15 FINAL RESULT
#javagamedevelopment #javatutorial #gameprogramming

Пікірлер: 51

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

    Dude you’re literally insane I will for sure come back and start your tutorial thank you for being so clear and having detailed conversation explanations

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

    Hi Ryi, I just want to say you are the best! and one day I will finish your game.

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

    Oh wow, I didn't expected your combed to be that interesting! Very impressive I must admit!

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

    wooo I enjoy coming to find new videos! great stuff like always!

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

    Ryi, are you a game developer, working in Japan? Your content is beyond my imagination :)))

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    I'm just a hobby programmer :)

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

    Thanks for uploading Ryi

  • @Glaxsy-ej3oq
    @Glaxsy-ej3oq Жыл бұрын

    Great work, keep it up

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

    Excellent video! One question. Are you planning on implementing multithreading in this game? If no, please, could you briefly explain how one would do this considering your existing code base (currently it's all about gamepanel where the game loop is). Any suggestions on where the multithreading can be used? (Maybe some complex in-game events, weather implementation). Also it would be very convenient if you started new series on LWJGL in Java. Anyway, thx for guides, keep up the good work!

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

    Ryi, perfect as always.

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

    Cool video!

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

    Very Good

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

    Thanks!

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

    Excelenty Ryi like always!! I found that the player can only open a door if he is above it, if it is to his right, left or above he cannot.. even if he has keys. Tnks!!!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Just checked the issue and although I could open the door from all directions, also noticed there are situations where the key doesn't work. I realized the calculation col = nextWorldX/gp.tileSize doesn't round the result value (for example 13.997 is still counted as 13) so sometimes you get a col number that is not where the door is. Here's the fix: (getDetected) switch(user.direction) { case "up": nextWorldY = user.getTopY()-user.speed; break; // change 1 to user.speed case "down": nextWorldY = user.getBottomY()+user.speed; break; // change 1 to user.speed case "left": nextWorldX = user.getLeftX()-user.speed; break; // change 1 to user.speed case "right": nextWorldX = user.getRightX()+user.speed; break; // change 1 to user.speed This fixed my issue. I tested 15 - 20 times from all directions and every time I could open the door.

  • @FerodriEste

    @FerodriEste

    Жыл бұрын

    @@RyiSnow tnks Ryi, woks perfect!!

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

    Hey great video, I was just wondering why would one of my sprites not be switching properly when in just one direction because my code is pretty much the exact same as yours and the direction performs the right functions but the guard sprite isn’t showing up, I tried using several instances of the sprite but nothing seems to work

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

    Suggestion, will there be ever main menu etc overhaul?

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

    Thank you!

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Thanks again for your kind support! ありがとう!

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

    Hey man, so I am making a game and basically I checked up on your tutorial on making a game full screen and I applied the same logic. Creating a buffered image and drawing it to the rescaled window. It works, however, just this one change alone to draw a buffered image to my window kills my performance, I get almost 20 times worse framerate (from 1000 to 60). Nobody on any java forums have been able to help so I am wondering if you would know the solution? How to up performance because drawing a single buffered image should not be this performance heavy, and this is the only change I made.

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

    Hello! Ryi whe do the stand counter appear and what for does it need? I follow your viddeos from the beggining and there was any word about it...

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    The stand counter was added in this extra video: kzread.info/dash/bejne/iaF7y7OPYteueco.html It sets the player in the standing position when you don't press any key for a while. The game works without it though.

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

    nice system.

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

    Another great video! How can I stop the knockback effect on player when he died because when you press retry player gets knockbacked immidietly?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    You can stop that by setting the player's knockback false. I'll clean up those game-over things in the next video.

  • @OneLatteComingRightUp
    @OneLatteComingRightUp21 күн бұрын

    My player still gets hurt when the orc isn't attacking. Any fixes?

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

    Ryi, it would be great to add idle animation to everyone)But actually your game looks very cool)

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

    Hi great video, I just noticed that if you died while the orc knockbacked you and then retry, you respawned with the knockback effect . How would you fix that?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Yup, I'll address the game over stuff in the next video since we've added some new things since we created the game over screen. You can disable the knockback effect by setting the player's knockback false.

  • @deepseatrip

    @deepseatrip

    Жыл бұрын

    @@RyiSnow ​ I also noticed after dying and retrying about 10-15 times that it nearly doubled the amount of memory usage on my computer. this very well could be something i have done, but curious if yours goes up significantly too after dying and retrying alot

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Hmm, I just tested it and didn't see any changes in performance. I died 30 times and retried the game but the game looked the same. No lagging or anything.

  • @deepseatrip

    @deepseatrip

    Жыл бұрын

    @@RyiSnow Thank you for testing on yours. I figured it out , I had created another timer that I had forgotten about, was planning on using it to tell the in game time. (then you released the Day Dusk Night video) and I forgot to remove the old timer i was working on. It was eating up so much memory lol I also had commented out the lines in the TileManager that only draws world in the camera view. I had forget i was messing around with drawing things not in camera view.

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

    The orc knock back me on tree tiles somehow and I can not move

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

    Great content as always Ryi! I've followed these series since the beginning and cant wait to implement this. Do you have any plans to implement game save/load functionality? I was trying to implement this on my own but i cant decide whether to do it with Serializable interface for each npc and object or simply a properties file..

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    The next video will be about save/load. Adding the interface on each object felt a bit of pain so I created a data class that contains whatever I want to save then serialized it so we only need to write/read one object. Saving the information about the objects on the map was much trickier than I thought though!

  • @pulkstenis1

    @pulkstenis1

    Жыл бұрын

    @@RyiSnow that sounds interesting, looking forward to your next video. The major problems that I encountered while trying to implement this was to not spawn a monster/npc on top of the player and to equip the correct equipments from inventory after loading it

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    I'm not sure about your monster/npc issue since in this program their spawn locations are fixed. Restoring the equipment info is a little bit tricky but you can handle it by saving the slot numbers of the items that you have equipped. It will be covered in the next video.

  • @pulkstenis1

    @pulkstenis1

    Жыл бұрын

    Ah sorry.. I had this issue because I made it so that the monsters respawn after some time. If the player was standing at the spot where the monster would spawn then once it spawned it would automatically kill the player. I somehow fixed this in the end though by using the collision checker.

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

    How can I donate ?

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    I have a Ko-fi page :) ko-fi.com/ryisnow

  • @darkpaladin.

    @darkpaladin.

    Жыл бұрын

    @@RyiSnow thank you so much man

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

    Cool

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

    Hi Ryi, I love your tutorial and thanks to you I am creating a 2d game for me and my friends but I want to make it multiplayer, with player interactions like you did with mobs etc. Is it possible for you to make an additional episode explaining how to implement this? Because I can't necessarily find things I want in other people's tutorial, so... Anyway, thanks for all the knowledge you share with everyone, because it means a lot to people like me who "learn by themselves" things via KZread etc. Hope you the best for the future Thanks

  • @RyiSnow

    @RyiSnow

    Жыл бұрын

    Glad you liked the tutorial. Sorry but this is a single-player game so no plan for adding multiplayer.

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

    🥰🥰🥰

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

    Hi RyiSow! I must say you are awesome :) Now I have solved the problem with fullScreenMap and MiniMap. So now it's working :) The problem was I had the old Tiles on placeholder. I took away the placeholder and now it's working :) Finally! I am happy you guys wanted to help me :) and I'm very happy about it. Now I have another strange problem. I can't open the doors with the keys. It just says in the game "What are you doing?". I have tried to solve this problem but I can' find it. please help me somebody.

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

    It would be nice to be able to implement a mechanism that can freely resize the screen like most applications and games we find out there!

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

    if i get my salary i will donate ive been watching your video since u started!!

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

    Can you make like a bike or a scooter in the next part? So that you can drive faster!

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

    whoaaa! that tutorial is amazing, I just discover it and straight after i finish my course with Tim Buchalka on udemy - where i can lern basics i will jump to this amazing tutorial! good luck guys and have fun!