excuse me i need help i'm getting an error message and im not able to move my character anymore
@aarushigiri71033 жыл бұрын
as soon as i try to move my character i get this error messaage: Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "solidArea" because "this.gp.obj[i]" is null at pptrialgame2/main.CollisionChecker.checkObject(CollisionChecker.java:98) at pptrialgame2/entity.Player.update(Player.java:83) at pptrialgame2/main.GamePanel.update(GamePanel.java:96) at pptrialgame2/main.GamePanel.run(GamePanel.java:83) at java.base/java.lang.Thread.run(Thread.java:833)
@RyiSnow3 жыл бұрын
The message indicates the program is trying to read an empty object. Did you instantiate objects in the AssetSetter? Also, did you add the condition "if(gp.obj[i] != null)" when you check object collision?
@aarushigiri71033 жыл бұрын
@@RyiSnow i think i did... can i send my code to you through mail? im sorry im new to coding so im making a lot of mistakes TT^TT
@RyiSnow3 жыл бұрын
Did you check if object is null or not when you draw objects in the paintComponent method?
@aarushigiri71033 жыл бұрын
@@RyiSnow yuppp it is null
@Abyss_Enjoyer2 ай бұрын
Bro’s helping random people he doesn’t know in the comment section, truly a legend
@streetfashiontv91493 жыл бұрын
Hi Ryi I really appreciate the time and effort you put into these tutorials as nobody is doing this for tile games in any language let alone java with the level of precision, stylistic elements and conceptual information that you provide. There is only one other programmer a C++ guy called Javid but he is a PhD and has built a game engine etc. Anyways I'm happy to see programmers who are passionate about Java and promoting game development in the language which I think it doesn't get enough credit especially when you consider that some of the greatest games were built in Java. I look forward to playing your game when it is released on Steam. Keep up the good work.
@RyiSnow3 жыл бұрын
Yeah it's a bit sad that not many people make games from scratch any more. In any case, I'm enjoying this and good to know that you are as well.
@natzos6372 Жыл бұрын
I always have to laugh at your reaction when you misspell things! I always see it beforehand and anticipate for you to realize :D
@botondkohanec2906 Жыл бұрын
You are not horrible, you are awesome!
@yashuchiha999 ай бұрын
reached episode 8, i am really enjoying . Lets goo
@GuildOfCalamity2 ай бұрын
Thank all that is holy that this man decided to use a dark theme... I'd say 95% of tutorials on YT have eyeball-burning light theme as the default.
@WarrenBainesMusic3 жыл бұрын
Firstly, absolutely love this tutorial, easily one of the best Java tutorials out there, really appreciate that you take the time to explain many concepts. I'm at the part where we are testing for object collision, and for some reason I'm not getting the console text output over objects like the key, but rather on a blank vertical line of grass near the second door! Any ideas where I'm going wrong?
@RyiSnow3 жыл бұрын
Glad you liked the video. That sounds like collision is triggered at a wrong spot. Probably something is wrong in checkObject method. Can I see your CollisionChecker class? Then maybe I can find out why. You can paste your code here.
@WarrenBainesMusic3 жыл бұрын
@@RyiSnow I did post the code however I spotted the error (after days of searching for it!), in the checkObject method, I had put entity.solidArea.y = entity.worldX + entity.solidArea.y; , and that reference to worldX should've been worldY. Feels so good when you fix errors like that.
@RyiSnow3 жыл бұрын
@@WarrenBainesMusic You mean you posted the code but got deleted? It happens from time to time. Anyways, good to know it was solved!
@forte22653 жыл бұрын
great job again! really appreciate these videos to go back to while i work
@tranminhquang73683 жыл бұрын
Great I hope to see a video of your enemy soon
@jimmyjakes18237 ай бұрын
To summarize the data flow for all the new classes, methods, etc, in the last couple videos: -Create a SuperObject class which sets up the default rectangle hitbox the items use and implements the draw() method that determines where the item is in on the world map in relation to the player and whether it's in view of the camera before sending it to be drawn. -Create individual item classes (Key, Door, etc.) which load images and can set collision properties that are unique to each item -Create an AssetSetter class that uses the setObject() method to determine what type of item will appear on the world map and where it will appear. These objects and their position are held in an array of SuperObject classes that is instantiated GamePanel. -Create a setupGame() method in GamePanel class which calls the setObject() method from AssetSetter class. We call the setupGame() method from Main so that it places the items on the world map before calling the startGameThread() method in GamePanel. -GamePanel class calls the draw() method from SuperClass so the items are drawn above the world map and below the player sprite in its paintComponent() method. It calls the draw() method in SuperClass using a for loop so that all the different items in the obj array are drawn on the world map in their unique place. -The checkObject() method in the CollisionChecker class is called from within the update() method in the Player class. It determines whether the player hitbox collides with the hitbox of an item on the map using the intersects() method from the Rectangle class. If returns an index value for the item collided with which is used for further processing. -The pickupObject() method is called later in the update() method of the Player class. It is passed the index value returned from the checkObject() method. In the code in this video, we use the index value to determine when the player picks up keys and if they have a key to open doors.
@solarcubing75042 жыл бұрын
I have done something different but pretty cool with the doors rather than setting it to null I added in another bool value + an image the boolValue is needs key and the image is open door basically if the needsKey value is set to true when the door is collided with then it goes to see if the player has a key and then if the player does it sets the collision to false and the image to the open door
@TheMemeSheep112 жыл бұрын
Could you please show me your code on how you did this. I am trying to implement it myself but I am having trouble.
@LouShunt3 жыл бұрын
Hey great video ! I use your video to great my own "game engine" so I can reuse the code to make another game quickly. I will love to see a tutorial on particule and window management (like full screen, resize window, etc).
@RyiSnow3 жыл бұрын
Cool! Yeah, separating a part of your code and stock them as your own tools/libraries is a great idea (especially when you repeat the same thing in every project) and it often makes your work a lot easier. I found creating tools is as fun as making games (I realized that when I made my 2D tile editor). I hope your engine will turn out good!
@unbroken-hunter2 жыл бұрын
@@Gabriel-mh7ek hey! So does this tool allow you to make a map using your png’s (like a normal tile editor), then get it in text format? If so, how did you do it because I’m looking for something like that :D
@termite17372 жыл бұрын
just cmt to beat KZbin's algorithm :))). Keep going!!!
@lem0nPlays137 ай бұрын
This is awesome! I'm can only pickup the bottom key atm but I'll make it work
@donavenbruce44072 жыл бұрын
Hello, i have a question, when my player touches to far to a structure its glitched and gets stuck and cant leave. any ideas let me know.
@wither_scout14683 жыл бұрын
Thank you as always for these videos. I really appreciate it :)
@adnan2734 Жыл бұрын
thanks for all videos, learning is ertertaining and informative :) You are legend.
@nadinewalter-lang93338 ай бұрын
you're legend in doing tutorials!
@cedricsahaghian1605 Жыл бұрын
I'm really enjoying your tutorials!
@dominiktworek64552 жыл бұрын
Oooh, amazing tutorial, ofc we could implement some OOP patterns like state, builder etc. but i will do it in my own projects. Maybe in future parts you do, but i didnt get there yet. I spend last half year on lerning java and thats amazing how this all puzzles fits together. Do you guys also fight with debugging? In here insted of index = i; in checkObject method i wrote return i; It took me 2h to figureout how to fix it. Whats amazing is that I take 10min break and then I fix it instantly.
@lucastucker2783 Жыл бұрын
I think at 15:18 you can check if the entity is a player without passing the boolean parameter to the 'checkObject' function. You could have simply done: if(entity instanceof Player) { index = i; }
@NguyenNam-yj1sg Жыл бұрын
thanks, I had a bug and I used your code and it worked 🥰
@luciuscouto45922 жыл бұрын
Excuse me, how could I implement the tile collision system on objects?
@kirtiprajapati9935 Жыл бұрын
My game player isn't picking the objects at the end of program
@SomeCoderYT10 ай бұрын
Whenever i try to move, i get this error message:Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 68 out of bounds for length 50 at CollisionChecker.CheckTile(CollisionChecker.java:39) at Player.update(Player.java:73) at GamePanel.update(GamePanel.java:117) at GamePanel.run(GamePanel.java:99) at java.base/java.lang.Thread.run(Thread.java:1583)
@NikitaBomba1122 жыл бұрын
Thanks you so much for this video!
@zakarianaji65848 ай бұрын
good! you do not need to add or subtract speed in order to determine the player coordinates in switch, because they are already defined in player class.
@holmdev3 жыл бұрын
I make it work with points to , in my game you can get points from apple and Carrots. thanks for a good video :)
@RyiSnow3 жыл бұрын
That's so cool! I just love when people use my code and make something their original :D Keep up the good work and thank you for letting me know!
@holmdev3 жыл бұрын
@@RyiSnow know i´m making some panel to have inventory in the top of the game, But also to see how many points you got, now you can only see it in the terminal.
@RyiSnow3 жыл бұрын
You can draw text on the screen with Graphics2D's drawString method so maybe you want to try that :) On-screen text will be featured in Part 10!
@holmdev3 жыл бұрын
@@RyiSnow im gone test that thanks
@AlexanderHL19199 ай бұрын
Awesome series!
@og_komorebi9 күн бұрын
i have an issue. Whenever my character moves it prints how many keys I have, and when it touches the key it doesn't pick it up
@TouchcreatorYTАй бұрын
for some reason randomly when i collected an object it gave me some out of range error and idk what to do
@feat.suhana3 ай бұрын
hey!! thank you for this tutorial . i am having a problem in the output , my door is not being solid and my character can easily pass through it even when it has no keys
@deborahlawani55394 ай бұрын
Hey i have an issue, when i try to run my code, my door collides if i don't pick up any key, but then even if i pick up a key i still can't pass through the door. And when i pick up all three all my doors disappear before i get to it
@billthompson43932 жыл бұрын
ik I'm late, but my character is getting stuck in the door when you don't have a key. Any help?
@kingkangiv1615 Жыл бұрын
Been a long while, but by any chance did you find a fix for this? Fixed it! The speed modifiers were being called after the if statement in the switch.
@logoman02342 ай бұрын
Hello! I’m Absoutly loving this tutorial series I recently found from your channel. I’m super curious to know if there’s a way to make it so that when you pickup the boots and increase player speed to make it only last for 5-10 seconds. I tried to make a separate integer as a “speed counter” and imitated it in the player class to “speed counter ++” Then an if statement to return the player speed after some time. But I’m having trouble forging this out. If you still monitor these comments I would love some help!
@RyiSnow2 ай бұрын
I think you're on the right track! Make sure to record the original speed so you can restore it when the speed up time is up!
@logoman02342 ай бұрын
@@RyiSnow hey Ryi, thanks so much for replying. here is the string of code that I'm having issues with case "Speed_Potion": speed += 2; gp.obj[i] = null; //-----------------------------------------10 seconds of speed +2------------------------------ SpeedCounter ++; if(SpeedCounter == 20){ System.out.println("speed counter"+ SpeedCounter); speed = 3; SpeedCounter = 0; } //--------------------------------------------returns base speed------------------------------ break; } } }
@leonelpereira26244 ай бұрын
Hi Ryi, I really enjoy your content, but I need help with this part. My checkObject function doesn't seem to work. Could you please help me?
@MyshaeA243 жыл бұрын
My object collision doesn't print the message “up, down… collision!”. I am trying to get to 14:15 in the video, can you help me? I usually never make comments and I've been able to solve all the problems by myself until now. I have tried so many things like re-watching this video and the previous one, and I re-checked my work around 5-6 different times. Also: Ryu if you are actually reading this, thank you! This series is SO awesome and helpful! I'm sorry I had to bring up my problem, but that aside I will try to keep following along :)
@RyiSnow3 жыл бұрын
No worries. Can I see your SuperObject, Player and CollisionChecker class? You can paste them here.
@MyshaeA243 жыл бұрын
Player: _____________________________________________________________________________________________ package entity; import java.awt.image.BufferedImage; import java.awt.Graphics2D; import java.awt.Rectangle; import java.io.IOException; import javax.imageio.ImageIO; import java.awt.Color; import main.GamePanel; import main.KeyHandler; public class Player extends Entity{ GamePanel gp; KeyHandler keyH; public final int screenX; public final int screenY; int hasKey = 0; public Player(GamePanel gp, KeyHandler keyH) { this.gp = gp; this.keyH = keyH; screenX = gp.screenWidth/2 - (gp.tileSize/2); screenY = gp.screenHeight/2 - (gp.tileSize/2); solidArea = new Rectangle(); solidArea.x = 8; solidArea.y = 16; solidAreaDefaultX = solidArea.x; solidAreaDefaultY = solidArea.y; solidArea.width = 32; solidArea.height = 30; setDefaultValues(); getPlayerImage(); } public void setDefaultValues() { worldX = gp.tileSize * 23; worldY = gp.tileSize * 21; speed = 4; // speed = gp.worldWidth/600; direction = "down"; } public void getPlayerImage() { try { up1 = ImageIO.read(getClass().getResourceAsStream("/player/boy_up_1.png")); up2 = ImageIO.read(getClass().getResourceAsStream("/player/boy_up_2.png")); down1 = ImageIO.read(getClass().getResourceAsStream("/player/boy_down_1.png")); down2 = ImageIO.read(getClass().getResourceAsStream("/player/boy_down_2.png")); left1 = ImageIO.read(getClass().getResourceAsStream("/player/boy_left_1.png")); left2 = ImageIO.read(getClass().getResourceAsStream("/player/boy_left_2.png")); right1 = ImageIO.read(getClass().getResourceAsStream("/player/boy_right_1.png")); right2 = ImageIO.read(getClass().getResourceAsStream("/player/boy_right_2.png")); }catch(IOException e) { e.printStackTrace(); } } public void update() { if(keyH.upPressed == true || keyH.downPressed == true || keyH.leftPressed == true || keyH.rightPressed == true) { if (keyH.upPressed == true) { direction = "up"; } else if(keyH.downPressed == true) { direction = "down"; } else if (keyH.leftPressed == true) { direction = "left"; } else if (keyH.rightPressed == true) { direction = "right"; } // CHECK TILE COLLISION collisionOn = false; gp.cChecker.checkTile(this); // CHECK OBJECT COLLISION int objIndex = gp.cChecker.checkObject(this, true); pickUpObject(objIndex); // IF COLLISION IS FALSE, PLAYER CAN MOVE if(collisionOn == false) { switch(direction) { case "up":worldY -= speed;break; case "down":worldY += speed;break; case "left":worldX -= speed;break; case "right":worldX += speed;break; } } spriteCounter++; if(spriteCounter > 12) { if(spriteNum == 1) { spriteNum = 2; } else if(spriteNum == 2) { spriteNum = 1; } spriteCounter = 0; } } } public void pickUpObject(int i) { if(i != 999) { String objectName = gp.obj[i].name; switch(objectName) { case "Key": gp.playSE(1); hasKey++; gp.obj[i] = null; System.out.println("Has:" + hasKey); break; case "Door": if(hasKey > 0) { gp.playSE(3); gp.obj[i] = null; hasKey--; } System.out.println("Key: " + hasKey); break; case "Boots": gp.playSE(2); speed += 1; gp.obj[i] = null; break; } } } public void draw(Graphics2D g2) { // g2.setColor(Color.white); // g2.fillRect(x, y, gp.tileSize, gp.tileSize); BufferedImage image = null; switch(direction) { case "up": if (spriteNum == 1) { image = up1; } if (spriteNum == 2) { image = up2; } break; case "down": if (spriteNum == 1) { image = down1; } if (spriteNum == 2) { image = down2; } break; case "left": if (spriteNum == 1) { image = left1; } if (spriteNum == 2) { image = left2; } break; case "right": if (spriteNum == 1) { image = right1; } if (spriteNum == 2) { image = right2; } break; } g2.drawImage(image, screenX, screenY, gp.tileSize, gp.tileSize, null); } } _____________________________________________________________________________________________
@MyshaeA243 жыл бұрын
SuperObject: __________________________________________________________________________________________________________________ package object; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.image.BufferedImage; import main.GamePanel; public class SuperObject { public BufferedImage image; public String name; public boolean collision = false; public int worldX, worldY; public Rectangle solidArea = new Rectangle(0, 0, 48, 48); public int solidAreaDefaultX = 0; public int solidAreaDefaultY = 0; public void draw(Graphics2D g2, GamePanel gp) { int screenX = worldX - gp.player.worldX + gp.player.screenX; int screenY = worldY - gp.player.worldY + gp.player.screenY; if (worldX + gp.tileSize > gp.player.worldX - gp.player.screenX && worldX - gp.tileSize < gp.player.worldX + gp.player.screenX && worldY + gp.tileSize> gp.player.worldY - gp.player.screenY && worldY - gp.tileSize< gp.player.worldY + gp.player.screenY) { g2.drawImage(image, screenX, screenY, gp.tileSize, gp.tileSize, null); } } } __________________________________________________________________________________________________________________
@RyiSnow3 жыл бұрын
Can you provide CollisionChecker too?
@MyshaeA243 жыл бұрын
@@RyiSnow The code wasn't working in the comments for some reason, so here's a link to the google doc with the info (hopefully this works): docs.google.com/document/d/10LaUFJ9s7t6COYnin0psqkPZNIExLjU2jELysEOfAT4/edit?usp=sharing
@nemdoom5 ай бұрын
Lovely course ^_^
@LawrenceDiaz-fj5vz8 ай бұрын
I think i have a problem, its that when i move all the objecs are teleported to the very top of the screen
@notmakhan Жыл бұрын
there's something wrong with my map. when i move my player downward there are only some tiles and then black background starts showing moreover my pickup object method isnt working. i have checked it several times but i still cant figure out
@progress2171 Жыл бұрын
Isn't it better to check if entity intersects with object outside of the switch ?
@freshie94 Жыл бұрын
I noticed that too, I think it's written like this because the checkTile method contains direction specific information in the if checks, but checkObject doesn't have that, so it's easier to just check after the switch ends. It's a small difference, but it does add to readability.
@kaleforlife63908 ай бұрын
bro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxedbro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxedbro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxedbro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxedbro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxedbro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxedbro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxedbro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxed
@SlothfulSage2852 жыл бұрын
Enjoyed it!
@harllemalves15902 жыл бұрын
Hi, thanks for the videos, i implemented a Interface that have a method called executeAction() to implement in objects and avoid switch
@worldofelectronicsandprogr11286 ай бұрын
Hi! I have a question: do you have a C or C++ background? :)
@josueronquillocassagne69112 жыл бұрын
Hi. Thanks for the tutoriales, I have a problem, My door isn't Solid, I can walk over it, I don't know why the code is the same, any idea for why it's happening that?
@kaleforlife63908 ай бұрын
bro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxed
@Rich_Cardboard3 ай бұрын
@RyiSnow I recently have been following the tutorial I think I’m having a logic error because it is not showing the error, but the code runs and when I go to the doors it prints 0 keys but I can’t pick up keys do you know how to fix this or would you want me to send the code
@Rich_Cardboard3 ай бұрын
I figured out the error if anyone has the same issue: in the pickUpObject method I wrote my case “key”: with a lower case letter and it should have been with a capital like this case “Key”:
@muhamadzulfikarfikri94822 жыл бұрын
i implement the diagonal movement, but yeah im stuck because when the player was interact with object that have collision value true the player just stuck, i think its because the for loop while getting the object. i hope i found the solution asap
@zapallito1286 Жыл бұрын
did u get the solution? im having the same problem here
@tardii_dah_gr82113 жыл бұрын
Hi Ryi I've followed up to this far however I don't know why my player is unable to interact with keys as well as the doors not performing any collision what do you think I.ve done something wrong or did i forget something or maybe made a mistake in a class the only thing I see that I'm is a scope above of the return command.
@RyiSnow3 жыл бұрын
May I see your CollisionChecker class? You can paste it here.
@akazza07Ай бұрын
@@RyiSnow same problem , which code i'll send u
@konstandinosdimitriou23013 жыл бұрын
can you make a home screen for the game with the option to resize the game to different resolutions ??
@droidlycodes2 жыл бұрын
You can make a separate class for this navigate to that class first then navigate to the game (Main class) from the home screen on PLAY button clicked ;). Hope this opens your mind I'm developing this game for Android currently, a little harder but I know sort of what I'm doing :)
@ackoly_dude44955 ай бұрын
@RyiSnow im sorry for pining you but.. IM COMPLETLY STUCK HERE! whenever i load the game i walk through the doors... i can pick up keys and open doors but when i dont have keys i just walk through and the doors dont disappear Update 2: i restarted my work from scratch and i did it alL by hand without the help of chatgpt and my current problem is that keys are not being currently displayed at first it was working but there was one key only being displayed but now there are none once i tried moving the code somewhere else.. What do you think the problem is? the problem is in player class picKUpObjects and i dont know what to do so i could fix this code
@clovercandii3 жыл бұрын
hello, thank you for this tutorial! when you are checking the first result i do not get the message "up/down/etc collision!" when touching key or door, and my door isn't solid either. Do you know what happened? please let me know if i should paste some code here
@clovercandii3 жыл бұрын
the only things i changed were what intellij suggested to me ("enhanced switch statements") like this: switch(entity.direction) { case "up": entity.solidArea.y -= entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("up collision!"); } break; case "down": entity.solidArea.y += entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("down collision!"); } break; case "left": entity.solidArea.x -= entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("left collision!"); } break; case "right": entity.solidArea.x += entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("right collision!"); } break; } to switch (entity.direction) { case "up" -> { entity.solidArea.y -= entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("up collision!"); } } case "down" -> { entity.solidArea.y += entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("down collision!"); } } case "left" -> { entity.solidArea.x -= entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("left collision!"); } } case "right" -> { entity.solidArea.x += entity.speed; if (entity.solidArea.intersects(gp.obj[i].solidArea)) { System.out.println("right collision!"); } } } and i didnt think things like that could impact the games functioning (switching it back didnt change anything either, still no "up collision!").
@clovercandii3 жыл бұрын
now that i went through the video again, i realized i was missing an int counter2 = 0, maybe that is what went wrong? i went through your last video as well and cannot find where you put the int counter2, could you please tell me what video it is in? sorry for the trouble, thank you so much again for this tutorial, it is very clear and simple to follow through.
@RyiSnow3 жыл бұрын
Don't worry about the counter2. That is for setting the player character in standstill position after he stopped moving. I doubt it's related with your issue (check part 10+ video if you are curious). Could you paste your CollisionChecker class here? Then I will take a look.
@clovercandii3 жыл бұрын
i figured it out; i think i accidentally typed gp.obj[i].solidArea.x twice by accident. thank you for letting me know about the counter2!
@akazza07Ай бұрын
@RyiSnow help i tried to help to find my error but cant fix by my own , so plz help me out . my full is perfectly work but my player could not available to receive key object . can u tell me the error ????
@dash84972 жыл бұрын
13:47 You obviously know what youre talking about, but you often say "parse this Player class" which is technically wrong. We only parse the pointer of the current instance of the class. Could be misleading for people who dont know the difference.
@lexhex69ao358 ай бұрын
What is the difference between entity and object x and y? Isn't it the same thing ?
@jarrodmcevoy3 жыл бұрын
Amazing video!!!!
@JavierYturriaga Жыл бұрын
can anyone help? I am at the end, I can get the player to pick up the key, key increases by one, but then I go down to the door and it does nothing it just stays there.. I have all the same code so I don't know why it's doing this...
@wc72763 жыл бұрын
HI Ryi, is it possible to post a tutorial on players shooting projectiles like bullets? I'm kind of lost on how to do it
@RyiSnow3 жыл бұрын
You can create bullets as Entity. Since I've received a couple of similar requests, I might squeeze a video at some point.
@wc72763 жыл бұрын
@@RyiSnow Ohh ok, thanks !
@RyiSnow3 жыл бұрын
If you're interested, this is a fireball demo that I recently posted on my twitter. The fireball was created as Entity. twitter.com/RyiSnow2017/status/1484146787980308480
@wc72763 жыл бұрын
@@RyiSnow Wow it looks so cool ! Would love your tutorial on this !
@wc72763 жыл бұрын
@@RyiSnow Hi RyiSnow, Can I ask, the way you create bullets is, first of all, create a child class called bullet which extends the entity class ? Then I also need to call the bullet class on the player and gamepanel class ? I just need a direction and some ideas so I can work on it. I know that the bullet class needs X and Y axis, so I will be using worldX and WorldY. for the direction, I will be using the player direction
@dahoodgnome Жыл бұрын
I'm having a small issue when checking the object collision. After I add the line: { int objIndex = gp.cChecker.checkObject(this, true); } into the update method inside of the Player class, all of my assets (chests, keys, and doors) disappear from the game. Omitting this line makes them reappear, but I don't see that as fixing the problem lol. I am getting a warning about the objIndex stating that its value is never used, only option it gives to remedy is to remove it all together. and again, I don't see that as a solution. I'm going to continue trying to figure this out. If anyone has any input or ideas of where I so obviously made a mistake, that would be much appreciated. 😁 I will update with my solution when it comes to me. So that took 5 minutes. I mistakenly used the = instead of the + when setting the positions of gp.obj[i]. I really need to pay a little more attention to detail!
@guilhermemonteiro604 Жыл бұрын
Thank you so much!
@dkitlle3 ай бұрын
saved me a ton of debugging
@elysiayeo54233 жыл бұрын
Hi, thank you so much for this tutorial! I would like to know how can I allow more spawning of the objects after all the objects have been collected?
@droidlycodes2 жыл бұрын
I just played with this today, you'd want a redraw method after a set time for the object or objects you want to redraw and place them in maybe .random locations on the screen for the player to collect at any time :).. I haven't tested the random placement part yet but you'd want a void to make sure the item doesn't get placed in the boarder for example!!
@AbdelrahmanHabshy2 ай бұрын
Isn't there a better way to do that I mean the objects are checking intersecting all the time
@cameronsmith18072 жыл бұрын
I have a string.hash code(); error because of objectName is null. How do I fix this
@droidlycodes2 жыл бұрын
HEELLLLPPP :) Hey so this is amazing, I even had to make my own Rectangle class for this method to work... Curious though, when my player interacts with the door for example if the player faces up or down when moving the collision is detected and the player is able to walk away perfectly fine. BUTTT when the door is placed on a horizontal plain so x axis the player gets stuck on the door and walks overtop. I'll keep looking at the code but I'm not seeing where or why this occurs.
@dash84972 жыл бұрын
why would you make your own rectangle class?
@droidlycodes2 жыл бұрын
@@dash8497 I am using Android Studio! the default class is different for AS!
@quentin45162 жыл бұрын
Anyone have a fix for when not having any key's, you can still pass through doors?
@quentin45162 жыл бұрын
nvm lol i got it
@sachmandhaliwal46182 жыл бұрын
@@quentin4516 if you dont mind me asking what did you fix? I am having the same problem
@quentin45162 жыл бұрын
@@sachmandhaliwal4618 I forgot, but I would check your player collision
@harounjaafar69182 жыл бұрын
but whit zoominout the man move how can i fix it?
@soneli4669 Жыл бұрын
You're the best!!
@anitaanonym73072 жыл бұрын
Hello, i need help. When i touch a object, it doesnt write " up collision"(or "down collision", "right collision" or left "collision").
@boprekz68762 жыл бұрын
i'm having the same issue
@kotziajohnnemesis94152 жыл бұрын
Hello and your videos are awesome anyways i have a problem with the two up map keys the game stops and the error says about the key that goes to null because they are already null for some reason (The Down key works correctly)
@kaleforlife63908 ай бұрын
bro has w rizz perchance? check the sigma base and see if any gyatts are getting fanum taxed
@gabrielwalker40623 жыл бұрын
Hey im having issues with my code not placing more than 1 object, for instance, I want to draw the door and the key but It only draws number 0 in the array (in this case only the door is being drawn)
@RyiSnow3 жыл бұрын
Did you assign a different index to your key?
@gabrielwalker40623 жыл бұрын
@@RyiSnow yes, my door is on [0] of the array, and the key is assigned to [1], but it only displays [0]. Everything else works perfectly though.
@RyiSnow3 жыл бұрын
Try adding this line after g2.drawImage in the SuperObject: System.out.println(name + " is displayed"); And check if "Key is displayed" is printed out on the console when the key is visible on the screen. If the text is printed out, the object is rendered but somehow the image is invisible so maybe something is wrong with your image. If the text is not printed out, the program is not drawing the key object so maybe something is wrong with your object array or the for loop to draw them.
@gabrielwalker40623 жыл бұрын
Yup its says that both are being displayed but only the door is being shown. Will check on it
@gabrielwalker40623 жыл бұрын
@@RyiSnow I made a bunch of other assets in the array and no matter how much I add, only the number 0 in the array is ever shown no matter the image/object. It says in the terminal that all of them are displaying but its not showing on the screen.
@truarrogancex Жыл бұрын
1:50 it's alright man I think it's funny
@thangduong11073 жыл бұрын
wow thank you
@MetinCloup3 жыл бұрын
good video
@komegaming35003 ай бұрын
If u want to use a better way of returning a non collision object u rather use -1 instead of 999. Its just a better practise, even though you prolly wont need it.
@fonzafeytt66443 жыл бұрын
RyiSnow, I keep getting this error when I try to run my movement, I get a null pointer error Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "solidArea" because "this.gp.obj[i]" is null at main.CollisionChecker.checkObject(CollisionChecker.java:74) at entity.Player.update(Player.java:88) at main.GamePanel.update(GamePanel.java:98) at main.GamePanel.run(GamePanel.java:82) at java.base/java.lang.Thread.run(Thread.java:833)
@fonzafeytt66443 жыл бұрын
it's an error at gp.obj[i].solidArea.x = gp.obj[i].solidAreaDefaultX; gp.obj[i].solidArea.y = gp.obj[i].solidAreaDefaultY;
@fonzafeytt66443 жыл бұрын
i fixed it
@CanePazzoHD2 жыл бұрын
@@fonzafeytt6644 how?
@helioktt2 жыл бұрын
entity.solidArea.x = entity.solidAreaDefaultX; entity.solidArea.y = entity.solidAreaDefaultY; gp.obj[i].solidArea.x = gp.obj[i].solidAreaDefaultX; gp.obj[i].solidArea.y = gp.obj[i].solidAreaDefaultY; These need to be inside of if (gp.obj[i] != null) Probably you've placed outside of it. move the 4 lines to fix it.
@RandomHandle-r2q2 жыл бұрын
@@helioktt You have no idea how much this helps. Thank you thank you!
@diegofourstage2 жыл бұрын
Hello, i do not getting collision, the keys disappear, but collision no happen
@foolian7126 ай бұрын
you are getting the collision if the keys are disappearing, because they disappear if your player collides with them
@arian.a41813 жыл бұрын
im here:)
@vosquz Жыл бұрын
for some reason, even though I defined the i variable as an int it still tells me I need to make it an integer, and i know this video is years old, but thanks for the videos in general!
@freshie94 Жыл бұрын
Are you using all lowercase? like "for(int i = 0....)" ?
@2MSTennis2 жыл бұрын
Thank you Ry again so much! When you get a chance I’d like to ask because my character goes to the door and gets stuck!
@MarkJohnFamisan Жыл бұрын
help my character can still pass through objects
@MrLoser-ks2xn2 жыл бұрын
Thanks!
@np.figwig87713 жыл бұрын
Why am I getting this when I tried to move my character? Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 168 out of bounds for length 50 at my2dgame.CollisionChecker.checkTile(CollisionChecker.java:54) at entity.Player.update(Player.java:86) at my2dgame.GamePanel.update(GamePanel.java:101) at my2dgame.GamePanel.run(GamePanel.java:76) at java.base/java.lang.Thread.run(Thread.java:831) I can't seem to fix it. can anybody help?????
@RyiSnow3 жыл бұрын
Looks like one of the index (col or row) for the mapTileNum is getting a number which is beyond the array's boundary (50). That is not supposed to happen so I think some calculation is not correct.
@pokeminestwodios2 жыл бұрын
I'm having the same issue. Did you ever figure this out?
@abikyoukan2 Жыл бұрын
having the same issue here. cant seem to fix it at all
@apro8723 Жыл бұрын
HOW TO FIX????@@RyiSnow
@alexholst813811 ай бұрын
@@apro8723 Don't know if this is relevant anymore or not, but I think it might be because of the statement: entity.solidArea.x = entity.worldX + entity.solidArea.x inside of the checkObject()-method in CollisionChecker. If you don't reset the value of the rectangles values like he does in 12:20 it will make the rectangle bigger than the map at some point - which would then give you an error since the array's boundary is only as big as the world (thus you get an array out of bounds exception).
@normalercarl Жыл бұрын
i am invested.
@maryamhussein81162 жыл бұрын
intersects don't work!! Help :(
@masterdob76002 жыл бұрын
same problem
@masterdob76002 жыл бұрын
how did you fix it???
@RisingCookie132 жыл бұрын
Update! in one of the next 1-2 videos, it will deleted^^ :P until now, the GamePanel's properties public final int worldWidth = tileSize * maxWorldCol; and public final int worldHeight = tileSize * maxWorldRow; were not used,.. Is there something I have overseen, or will this come yet ^^' :P ..but I will see anyways :D this is so much fun to learn, and to create individually
@ferry67002 жыл бұрын
Hi Ryi, I need help I able to detect and make the object going null , I check using System.out.println(gp.obj[i]); gp.obj[i] = null; System.out.println(gp.obj[i]); but the image keep there not gone, what do you think Should I check?
@ferry67002 жыл бұрын
after I check at the game actually the key is disappeared, but only one and specific one key
@ferry67002 жыл бұрын
ahh my bad :D I typo if(player == true) { index = 1; } it should be if(player == true) { index = i; } that's why only object number one that always disappear XD
@udaybhokre5913 жыл бұрын
The door doesn't open when I have more than 0 keys
@law39222 жыл бұрын
I had a similar problem. It was because I had written "Door" as "door" in the pickUpObject method
@arpanadhikari6881Ай бұрын
@law3922 You saved me. I was stuck there cause my door would not open. Thank you so much
@vivitronthereal42983 жыл бұрын
Hey RyiSnow I fixed the first error. But now whenever i run the game and try to move, I get a null pointer.
@vivitronthereal42983 жыл бұрын
Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "solidArea" because "this.gp.obj[i]" is null at Main.CollisionDetection.checkObject(CollisionDetection.java:79) at entity.Player.update(Player.java:89) at Main.GamePanel.update(GamePanel.java:97) at Main.GamePanel.run(GamePanel.java:72) at java.base/java.lang.Thread.run(Thread.java:831)
@RyiSnow3 жыл бұрын
Did you instantiate the object? Also, did you add the line "if(gp.obj[i] != null)"? NullPointerException error occurs when program tries to refer to an instance but it was empty (null).
@vivitronthereal42983 жыл бұрын
@@RyiSnow Yes I did add if(gp.obj[i] != null).
@vivitronthereal42983 жыл бұрын
@@RyiSnow Still doesn't work
@kirtiprajapati9935 Жыл бұрын
It's showing FPS:60
@deborahlawani55394 ай бұрын
In your game panel class, you have to remove the System.out.println("FPS:" + drawCount);
@Spluli Жыл бұрын
CODE in Answers
@Spluli Жыл бұрын
CODE Player: package entityFolder; import java.awt.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import main.GamePanel; import main.KeyHandler; public class Player extends Entity { GamePanel gp; KeyHandler keyH; public final int screenX ; public final int screenY ; int hasKey = 0; public Player(GamePanel gp, KeyHandler keyH) { this.gp = gp; this.keyH = keyH; screenX = gp.screenWidth/2 - (gp.tileSize/2); screenY= gp.screenHeight/2 - (gp.tileSize/2); solidArea = new Rectangle(); solidArea.x = 8; solidArea.y = 16; solidAreaDefaultX = solidArea.x; solidAreaDefaultY = solidArea.y; solidArea.width = 32; solidArea.height = 32; setDefaultValues(); getPlayerImage(); } public void setDefaultValues() { worldX = gp.tileSize * 23; worldY = gp.tileSize * 21; speed = 4; direction = "down"; } public void getPlayerImage() { try { up1 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_up_1.png") ); up2 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_up_2.png") ); down1 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_down_1.png") ); down2 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_down_2.png") ); left1 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_left_1.png") ); left2 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_left_2.png") ); right1 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_right_1.png") ); right2 = ImageIO.read( getClass().getResourceAsStream("../res/player/boy_right_2.png") ); } catch (Exception e) { e.printStackTrace(); } } public void update() { if ( keyH.upPressed == true || keyH.downPressed == true || keyH.leftPressed == true || keyH.rightPressed == true ) { if (keyH.upPressed == true) { direction = "up"; } else if (keyH.downPressed == true) { direction = "down"; } else if (keyH.rightPressed == true) { direction = "right"; ; } else if (keyH.leftPressed == true) { direction = "left"; } // CHECK TILE COLLISION collisionOn = false; gp.cChecker.checkTile(this); // CHECK OBJEKT COLLISION int objIndex = gp.cChecker.checkObject(this, true); pickUpObject(objIndex); // IF COLLISION = FALSE, PLAYER CAN MOVE if(collisionOn == false){ switch(direction){ case "up" : worldY -= speed; break; case "down" : worldY += speed; break; case "right": worldX += speed; break; case "left" : worldX -= speed; break; } } spriteCounter++; if (spriteCounter > 10) { if (spriteNum == 1) { spriteNum = 2; } else if (spriteNum == 2) { spriteNum = 1; } spriteCounter = 0; } } } public void pickUpObject(int i){ if(i != 999){ String objectName = gp.obj[i].name; switch(objectName){ case "Key" : hasKey++; gp.obj[i] = null; break; case "Door" : if(hasKey > 0){gp.obj[i] = null;hasKey--;} break; // case "Boots": speed += 3; gp.obj[i] = null; break; } } } public void draw(Graphics2D g2) { // g2.setColor(Color.WHITE); // g2.fillRect(x, y, gp.tileSize, gp.tileSize); BufferedImage image = null; switch (direction) { case "up": if (spriteNum == 1) { image = up1; } if (spriteNum == 2) { image = up2; } break; case "down": if (spriteNum == 1) { image = down1; } if (spriteNum == 2) { image = down2; } break; case "right": if (spriteNum == 1) { image = right1; } if (spriteNum == 2) { image = right2; } break; case "left": if (spriteNum == 1) { image = left1; } if (spriteNum == 2) { image = left2; } break; } g2.drawImage(image, screenX, screenY, gp.tileSize, gp.tileSize, null); } }
@Spluli Жыл бұрын
CODE Super Obj: package objects; import java.awt.image.BufferedImage; import main.GamePanel; import java.awt.*; public class SuperObject { public BufferedImage image; public String name; public boolean collision = false; public int worldX , worldY; public Rectangle solidArea = new Rectangle(0,0,48,48); public int solidAreaDefaultX = 0; public int solidAreaDefaultY = 0; public void draw(Graphics2D g2, GamePanel gp){ int screenX = worldX - gp.player.worldX + gp.player.screenX; int screenY = worldY - gp.player.worldY + gp.player.screenY; if( worldX + gp.tileSize > gp.player.worldX - gp.player.screenX && worldX - gp.tileSize < gp.player.worldX + gp.player.screenX && worldY + gp.tileSize > gp.player.worldY - gp.player.screenY && worldY - gp.tileSize < gp.player.worldY + gp.player.screenY // ){ g2.drawImage(image, screenX, screenY, gp.tileSize, gp.tileSize, null); } } }
@EntificationALTWow2 жыл бұрын
"imagine not putting your own twists to a game a youtuber has a tutorial on" -me
@furbos3278 Жыл бұрын
Can you please help me, I don't understand why it's not working. I got this message : Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "name" because "this.gp.obj[i]" is null at entity.Player.pickUpObject(Player.java:144) at entity.Player.update(Player.java:106) at main.gamePanel.update(gamePanel.java:108) at main.gamePanel.run(gamePanel.java:89) at java.base/java.lang.Thread.run(Thread.java:1623)
@RyiSnow Жыл бұрын
Check the line 144 in the Player class! That's where something went wrong.
@jamesconwell27673 жыл бұрын
Algorithm comment
@coolfactor17962 жыл бұрын
Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 184 out of bounds for length 50 at main.CollisionChecker.checkTile(CollisionChecker.java:36) at entity.Player.update(Player.java:93) at main.GamePanel.update(GamePanel.java:150) at main.GamePanel.run(GamePanel.java:137) at java.base/java.lang.Thread.run(Thread.java:831) how can I fix this?
@dgarrard1002 жыл бұрын
-I managed to fix a similar error by removing the lines "entity.solidArea.y -= entity.speed" etc. in the "checkObject" method's switch statement. I'm not sure if that'll cause more problems down the line or not, though.- Update: I believe this actually did cause a problem where I would become unable to move when touching any collidable object (except doors I had the key to). I ended up restarting this program from scratch, and now I'm not getting the error. I'm still not sure what caused the error in the first place; I would recommend just rewriting the method from scratch, and if that doesn't work, rewriting the class from scratch.
@coolfactor17962 жыл бұрын
@@dgarrard100 thx for your answer
@abikyoukan2 Жыл бұрын
damn im having the exact same problem here and its quite weird because this error happens when I try to move ingame. very strange
@vivitronthereal42983 жыл бұрын
Hey RyiSnow!! I love your videos so much. For some reason im getting an error on " gp.obj[i].solidArea.x = gp.obj[i].solidAreaDefaultX; gp.obj[i].solidArea.y = gp.obj[i].solidAreaDefaultY;" Anything im doing wrong?
@vivitronthereal42983 жыл бұрын
It says "solidAreaDefaultX cannot be resolved or is not a field"
@RyiSnow3 жыл бұрын
May I see your CollisionChecker class?
@vivitronthereal42983 жыл бұрын
@@RyiSnow It wont let me send it
@RyiSnow3 жыл бұрын
Did you create those two variables in SuperObject class?
@vivitronthereal42983 жыл бұрын
@@RyiSnow omg i didnt
@rafaelroriz66222 жыл бұрын
Hey, great video. Im having a problem, and I need some help. All my objects are being placed at the top of the map when I add this line "int objindex = gp.cChecker.checkObject(this, true);" in the player class. What could it be ? I could send you my code if needed.
@RyiSnow2 жыл бұрын
Maybe you haven't set their worldX and worldY?
@rafaelroriz66222 жыл бұрын
@@RyiSnow yeah it was that. Thanks.
@woodswoody55532 жыл бұрын
Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "solidArea" because "this.gp.obj[i]" is null at main.CollisionChecker.checkObject(CollisionChecker.java:116) at entity.Player.update(Player.java:107) at main.GamePanel.update(GamePanel.java:155) at main.GamePanel.run(GamePanel.java:137) at java.base/java.lang.Thread.run(Thread.java:833)
@helioktt2 жыл бұрын
entity.solidArea.x = entity.solidAreaDefaultX; entity.solidArea.y = entity.solidAreaDefaultY; gp.obj[i].solidArea.x = gp.obj[i].solidAreaDefaultX; gp.obj[i].solidArea.y = gp.obj[i].solidAreaDefaultY; These need to be inside of if (gp.obj[i] != null) Probably you've placed outside of it. move the 4 lines to fix it.
@anasfaisal45815 ай бұрын
@@helioktt Broooooo you don't know how many moths i took to figure this issue out!!!!! i thank you very much!!!
@kn0x6902 жыл бұрын
Hello, I tried your method the collision of object and the player is perfectly fine and return the right object index however when I set null value in obj[] from pickUpObject method I got this error Exception in thread "Thread-4" java.lang.NullPointerException at main.Collision.checkObject(Collision.java:138) at entity.Player.updatePos(Player.java:163) at entity.Player.update(Player.java:84) at main.GameLoop.update(GameLoop.java:39) at main.GameLoop.run(GameLoop.java:66) at java.lang.Thread.run(Thread.java:745)
@kn0x6902 жыл бұрын
and I want to add animation to object how can I do that?
@kn0x6902 жыл бұрын
I fixed the issue but how about animation?
@hydrogennetwork Жыл бұрын
help i'm getting an error and i can't move it after Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "name" because "this.gp.obj[i]" is null at entity.Player.pickUpObject(Player.java:117) at entity.Player.update(Player.java:81) at main.GamePanel.update(GamePanel.java:88) at main.GamePanel.run(GamePanel.java:74) at java.base/java.lang.Thread.run(Thread.java:1583)
@RyiSnow Жыл бұрын
Looks like you're trying to read an empty object at line 117. There should be a reason for that so I suggest you look into that.
@hydrogennetwork Жыл бұрын
i looked into it like a bajillion times and just checked again but it doesn't help
@hydrogennetwork Жыл бұрын
nevermind it's fixed thanks for the help anyway
@hydrogennetwork Жыл бұрын
nevermind again its still there
@hydrogennetwork Жыл бұрын
@RyiSnow it's been 14 hours
@mariocraft9872 ай бұрын
For anyone that has this error: Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 10 out of bounds for length 10 at main.CollisionChecker.checkObject(CollisionChecker.java:67) at entity.Player.update(Player.java:86) at main.GamePanel.update(GamePanel.java:118) at main.GamePanel.run(GamePanel.java:103) at java.base/java.lang.Thread.run(Thread.java:1570) try checking your i loop in checkObject() and see if you mispelled your "i" as a "1".
@coolfactor17962 жыл бұрын
i need help because i have this error meesage and i am not able to move the charackter Exception in thread "Thread-0" java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because "entity.solidAreaDefaultY" is null at main.CollisionChecker.checkObjekt(CollisionChecker.java:108) at entity.Player.update(Player.java:100) at main.GamePanel.update(GamePanel.java:150) at main.GamePanel.run(GamePanel.java:137) at java.base/java.lang.Thread.run(Thread.java:831)
@coolfactor17962 жыл бұрын
I place this highe : entity.solidArea.x = entity.solidAreaDefaultX; entity.solidArea.y = entity.solidAreaDefaultY; gp.obj[i].solidArea.x = gp.obj[i].solidAreaDefaultX; gp.obj[i].solidArea.y = gp.obj[i].solidAreaDefaultY; and optain this error message: Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 184 out of bounds for length 50 at main.CollisionChecker.checkTile(CollisionChecker.java:28) at entity.Player.update(Player.java:93) at main.GamePanel.update(GamePanel.java:150) at main.GamePanel.run(GamePanel.java:137) at java.base/java.lang.Thread.run(Thread.java:831)
@RyiSnow2 жыл бұрын
Did you instantiate the solidArea in Entity?
@coolfactor17962 жыл бұрын
@@RyiSnow hi thx for your help i fixed the problem (i wrote AreaDefaultX= areay;
@abikyoukan2 Жыл бұрын
@@coolfactor1796 where did you put this?
@Anarkiados2 жыл бұрын
Hello, and huge thanks for your amazing tutorials Ryi! I'm encountering an error the moment my character touches the Key Object (I've added what's in each line to the error message below): Exception in thread "Thread-0" java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "" is null at entity.Player.pickUpObject(Player.java:123)
@RyiSnow2 жыл бұрын
Check the pinned comment!
@Anarkiados2 жыл бұрын
@@RyiSnow I did, trust me! It didn't help and I'm getting a different sort of error: "Cannot invoke "String.hashCode()" because "" is null" I've tried moving brackets, I've gone through this video and the previous one to try and see where I go wrong but I simply cannot find what I'm doing wrong D: