Object Detection/Loot - How to Make a 2D Game in Java #42

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

Комментарии • 30

  • @RyiSnow
    @RyiSnow  2 года назад +13

    Bug Fix:
    I've 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

  • @tothpeter2296
    @tothpeter2296 Год назад +1

    My dialogue when Blue Boi consumes a "Key"
    "Are you trying to eat the Key?!
    You donkey!"
    Just a slight play with words (eating is a derivative of consuming)

  • @Langostaz
    @Langostaz 2 года назад +1

    Awesome! thanks for releasing great content!

  • @dustinodett
    @dustinodett 8 месяцев назад

    @ryiSnow I am so excited!!!!! I have learned so much from you! I took what we did with the merchant npc and made a storage chest out of that code! It took me all day to work out the problems I kept facing but I succeeded! Thank you!

  • @gregoryfir3841
    @gregoryfir3841 2 года назад +3

    Thank you, RyiSnow! It's amazing video! Please, could you explain how to do critical damage for weapons, if you have the time and desire. I tried to do this, but it turned out that the weapon just got a random attack value for the whole game. Thanks again

    • @RyiSnow
      @RyiSnow  2 года назад +1

      You can set a percentage for critical hits (and a critical damage too if you want) on each weapon like this:
      [Entity]
      public int criticalRate;
      [Weapon]
      criticalRate = 8;
      Then when you give damage to a monster, use the Random class and get a number between 1 to 100. If the number is within the current weapon's criticalRate (1 to 8), double the damage or add an extra number.

  • @dusklycanrocvlogs
    @dusklycanrocvlogs 2 года назад

    Hi RyiSnow! I noticed in later videos that in the OBJ_Chest class, you have a method written called setLoot, in which video did you write this method because I've looked at the later videos and couldn't find where exactly it was written. I'd like to know where we call this method and how to pass the loot through the method. Thanks!

    • @RyiSnow
      @RyiSnow  2 года назад

      I did it when I implemented the save and load system!

  • @Nick-ns3vj
    @Nick-ns3vj 2 года назад

    can you make a tutorial on how to make lighting (for example from a lightbulb: A small lightened area)? And also, about how to make the game's lighting darker in general, like in a horror game. Or just at night - How to make the screen go dark xD. Cause I wanna implement a lantern item in a ruin, and I need to know how lighting works

  • @Optimabr
    @Optimabr 2 года назад +2

    how long have you been programming games?

    • @RyiSnow
      @RyiSnow  2 года назад +1

      I wrote my first Hello World program about 6 years ago.

    • @Optimabr
      @Optimabr 2 года назад

      @@RyiSnow thank you very much for the reply, hugs from Brazil

  • @ericthebattletechengineer9899
    @ericthebattletechengineer9899 Год назад

    There is a bug in this one. If you place some coins, or pick them up when you kill a monster, you get an error. It is because under player/pickUpObject, it is nulling out type_pickupOnly items BEFORE it then looks to see if its an obstacle or inventory. Need to add an if loop around the code after the pickup to check if the gp.obj[gp.currentMap][i] != null to avoid it. Hopefully he fixed it later.

  • @hamzaa7335
    @hamzaa7335 2 года назад

    nice tutorial bro, but where you have this knowledge?

  • @UnderArea51
    @UnderArea51 2 года назад

    IDEA: Who is be possible to add a bit of code to give our player's hero a NPC who follows with him around? - Perhaps a pet wolf or hawk. It would be great if the wolf could attack monsters - automatically when they get near the hero.

    • @RyiSnow
      @RyiSnow  2 года назад +3

      Check the Part 40. We implemented an NPC who follows the player and monsters who attack the player when they detected him. Combined with them you can create an NPC who follows the player and attacks monsters nearby.

  • @bluethemcguy4430
    @bluethemcguy4430 2 года назад +1

    Hi RyiSnow, if possible could you give me a thought on how to implement infinite world generation? I really want to implement this in my game.

  • @hugodoquoc1262
    @hugodoquoc1262 2 года назад

    Hi, i have an issue. If I add boots and it speeds up my character and then try to open the door, it just cannot be done because the col or row does not match. Currently default speed is 4 and with the boot is 5.Do you know how to fix it?

  • @MrLoser-ks2xn
    @MrLoser-ks2xn 2 года назад

    Thanks!

  • @chrisfeasby7528
    @chrisfeasby7528 Год назад

    Hey @RyiSnow! At this point I just noticed my generate particle doesn't work anymore for cutting down trees and I had to try to make it work when we changed the list to [][] array for the projectileList.add(p1) ... projectileList.add(p4) etc ... I made it work for the destroying of the enemies rocks but the trees do not get damaged anymore ... can you or someone else Please post the code for Entity's generateParticle(Entity generator, Entity target) Up to this point in the series so I can see the fix for that method when everything was changed to double array [][] (This method you must of fixed on own as it was not shown in the video at the time nor since)
    Appreciate it greatly if you could post that! Thanks! And as always LOVE the tutorials!! :)

    • @RyiSnow
      @RyiSnow  Год назад +1

      Hi, I didn't change the generateParticle method. It's the same as I showed in the particle video.

    • @chrisfeasby7528
      @chrisfeasby7528 Год назад

      But you changed ArrayListprojectileList to Entity[][] projectile ..
      Now in that generateParticle method in Entity we have to change it otherwise there would of been errors?
      It used to be
      gp.projectileList.add(p1)… to .add(p4)
      Can you double check your Entity generateParticle() to see

    • @RyiSnow
      @RyiSnow  Год назад +1

      I changed the projectile list to two-dimensional but kept particleList one-dimensional since particles just disappear and we don't need to keep them on the map. Maybe you changed the particleList to two-dimensional by mistake?
      And yes, I double-checked my latest generateParticle method and the method I showed in the particle video and they were identical.

    • @chrisfeasby7528
      @chrisfeasby7528 Год назад

      @@RyiSnow it doesn’t appear like it? The particle list is not two dimensional.. I’m not sure what happened but I guess it doesn’t matter. I’ll redo your tutorial for further experience after I do the rest of your you tube tutorials on Java as you are very good.
      Having a GitHub account would help matters greatly but I understand this world is full of thieves who steal and release as their own.
      I hope you continue to make RUclips tutorials- I’ll definitely be watching!! 🙂

  • @momagi6039
    @momagi6039 2 года назад

    Nice!

  • @MrLoser-ks2xn
    @MrLoser-ks2xn Год назад

    🥰🥰🥰

  • @Optimabr
    @Optimabr 2 года назад

    Nice

  • @GageOlsonCybersecurity
    @GageOlsonCybersecurity 2 года назад

    Do you have a discord?