Thank you very much for these wonderful tutorials. I watched many videos on how to create video games and the truth is that for now your tutorials are the best I've ever found. You explain very well how video games work. Good luck, surely your channel will grow and in a few years you will have many subs
hey Kaarin, i've already compare my code with your code at github, but when I run my code the player doesn't move when I press the WASD keys. i hope you can help me to solve this problem. anw thank you for the tutorial, It help me to do my final project
@@felcy1458 hey there, what did you do?? i got the same problem...i checked my brackets too. i hope you reach me out soon. i'm doing it for my project too!
Hey. That is because the player is roughly 20x28 in size in the sprites. This will be the actual hitbox for the player, not the size of the entire sprite thats 64*40
I had the same problem. You may have to visit Player class, render() method, g.drawImage and incorporate Scale into the width and height. Kaarin may have done this offscreen.
My hitbox doesn't center on the player. Worse, it changes based on the scale of the game. Edit: Had apply SCALE when rendering player and had to correct x and y offsets.
Hi Kaarin, sorry for the late question. i want to ask about how you can scale player Sprite by just changing the SCALE variable inside Game.java . how can you do this? when i change SCALE value, my player sprite does not resize
is this Separating Axis Theorem? (SAT) I've read that SAT is commonly known to be used to detect collision in games and i want to implement it, i've also read that it works by checking the axis of the hitbox so i wanna know if this is it because it seems like it, i've searched tutorials bout SAT but i havent found any :S
Hey. Mostly a recording miss. I restarted over and over again at so many places, and sometimes some parts where left out. But you will still be able to follow along regardless :)
I’m a total beginner so this might be a stupid question, but if we’re always gonna have to cast float back into integer, what’s the point of making it float in the first place? And what’s the difference between float and double and why do you choose to use float and not double?
Hey. There is a few reasons why we keep float and then turn it into int. From experience it's much easier to spot why, but let me give you an example: With int, we can at lowest speed, increase the player position by 1 pixel each update. That would be 200 pixels per second at 200 ups. That is VERY fast. However, if we have it with float, we can increase it as slow as we want. and then just go from float to int when we draw. Some updates will have the same int value, but the float value changes behind it to match the speed we want. Difference between float and double is the precision. Meaning a double can have more decimals than a float but also takes up more memory. So if we don't need to be so precise, no need to use double. When working with timing, we need to use double.
Please can anyone tell me why my player can’t be stay focused I mean the bug which u solved in previous episode in my code is not working no matter how to change it I did exactly what u did but still running outside frame when u click on board he continues his direction 😢
In Game class one method with windowsFocusLost in Player class resetDirBoolean and set all directions to false then in GameWindow add jframe addFocusListener inside focus lost method call gamePanel.getGame().windowsFocusLost method
Hey. Great Job! Thank You dir your Work! I've decided to build level in level editor. So I have whole lvl in 1 PNG 1:1. What should be my approach regarding collision detection? Should I change it?
Thanks for the kind words =) We cover how to add more levels and also how you as followers can add and make your own levels in a later episode. No need to change the code for collision because the level changed.
Hi kaarin, Great project and thank you sharing it. I've done so far what you did in the video, but after compilation it says "out of bounds", what should I do?...
Hey! Sounds like you have an array that tries to access something that is outside the lenght of the array. Take a look at the error and it will tell you where the error occour. There is github to compare your code to
50th like so please enlighten my brain... Collision works great buttttt, when I spawn in monsters in my game at random locations sometimes they spawn over another monster causing it to get stuck. I swear I have spent multiple hours trying different ideas with my auto spawn system but nodddda luck 🙃
Here's my logic, by default monster collision false in draw method. Then monster checks monster array to see if intersects also is supposed to check if not monster equals monster but it doesn't appear that is the case. It just bypasses this call & sets collision to true when one monster overlaps another. My brain hurts tried even writing a new class with no animation & still no luck.
I love ur tutorials btw, clear enough
Thank you very much for these wonderful tutorials. I watched many videos on how to create video games and the truth is that for now your tutorials are the best I've ever found. You explain very well how video games work. Good luck, surely your channel will grow and in a few years you will have many subs
Cheers man!
Appreciate the kind words :)
its just Wonderful, thak you so much for thes tutorials 😍😍
Cheers mate! :D
i love your videos
Amazing
Awesome
thank youu vary good lesson
Question: the knowlege you have about Java, you learned searching around or was there a specific course you took?
Utube, searching around and tutorials
I hope this project can help me get an internship so thank you.
Best of luck! :D
hey Kaarin, i've already compare my code with your code at github, but when I run my code the player doesn't move when I press the WASD keys. i hope you can help me to solve this problem. anw thank you for the tutorial, It help me to do my final project
Hey. Glad you like it. Its better to ask for help on discord. Most likely you missed a bracket or forgot to add a call to the playing state.
@@KaarinGaming greatt, thank you
@@felcy1458 hey there, what did you do?? i got the same problem...i checked my brackets too. i hope you reach me out soon. i'm doing it for my project too!
Hi ! Really nice tutorials ! At 25:47 why is did you put 20 as width and 28 as height ?
Hey.
That is because the player is roughly 20x28 in size in the sprites. This will be the actual hitbox for the player, not the size of the entire sprite thats 64*40
@@KaarinGaming thank you a lot. That helped to calculate the hitbox for my character
absolute legend
starting to get lost
When I use 1.5 scale it does not draw player in the hit box, but outside it. How to fix that?
I had the same problem. You may have to visit Player class, render() method, g.drawImage and incorporate Scale into the width and height. Kaarin may have done this offscreen.
My hitbox doesn't center on the player. Worse, it changes based on the scale of the game.
Edit: Had apply SCALE when rendering player and had to correct x and y offsets.
Hi Kaarin, sorry for the late question. i want to ask about how you can scale player Sprite by just changing the SCALE variable inside Game.java . how can you do this? when i change SCALE value, my player sprite does not resize
Hey.
You most likely forgot to add scale to your player. Github have all the code for you to compare.
wow thank you so much, I absolutely did not expect you to answer me directly right here@@KaarinGaming
is this Separating Axis Theorem? (SAT) I've read that SAT is commonly known to be used to detect collision in games and i want to implement it, i've also read that it works by checking the axis of the hitbox so i wanna know if this is it because it seems like it, i've searched tutorials bout SAT but i havent found any :S
I have no clue. Not heard of it before
Hello when did height and width get included in the entity class? It just popped out of nowhere
Hey.
Mostly a recording miss. I restarted over and over again at so many places, and sometimes some parts where left out. But you will still be able to follow along regardless :)
I’m a total beginner so this might be a stupid question, but if we’re always gonna have to cast float back into integer, what’s the point of making it float in the first place? And what’s the difference between float and double and why do you choose to use float and not double?
Hey.
There is a few reasons why we keep float and then turn it into int. From experience it's much easier to spot why, but let me give you an example:
With int, we can at lowest speed, increase the player position by 1 pixel each update. That would be 200 pixels per second at 200 ups. That is VERY fast. However, if we have it with float, we can increase it as slow as we want. and then just go from float to int when we draw. Some updates will have the same int value, but the float value changes behind it to match the speed we want.
Difference between float and double is the precision. Meaning a double can have more decimals than a float
but also takes up more memory. So if we don't need to be so precise, no need to use double. When working with timing, we need to use double.
Thank you for the explanation! I think I understand why now. Your videos are so helpful
Please can anyone tell me why my player can’t be stay focused I mean the bug which u solved in previous episode in my code is not working no matter how to change it I did exactly what u did but still running outside frame when u click on board he continues his direction 😢
I’m also following code from website so I checked many times all the related classes all are the same but the bug is still there
In Game class one method with windowsFocusLost in Player class resetDirBoolean and set all directions to false then in GameWindow add jframe addFocusListener inside focus lost method call gamePanel.getGame().windowsFocusLost method
Problem solved inside windowFocusListener I called FocusListener it should be new WindowFocusListener 😅
when did height and width were added in class entity?
8:02 - Detect Collisions
I really love your tutorials, but I got to ask though how do I add more levels or do you have a tutorial on how to add new levels?
Cheers =)
It gets addressed in a later episode. Last one covers it for example.
@@KaarinGaming Thank you so much!
why isn't the position of sprite changing with the subtraction in offset. i thought we will repaint or render hit box on top of the sprite
im wondering why you chose java swing. I honestly think its powerful enough til you get to using shaders and more advanced collision
I only can move left or right so if i press w The player is goind left and when i press s hes movig right
And when i press a and w or s and d together the player is entering god mode and is so fast
Hey. Great Job! Thank You dir your Work! I've decided to build level in level editor. So I have whole lvl in 1 PNG 1:1. What should be my approach regarding collision detection? Should I change it?
Thanks for the kind words =)
We cover how to add more levels and also how you as followers can add and make your own levels in a later episode.
No need to change the code for collision because the level changed.
Hi kaarin, Great project and thank you sharing it. I've done so far what you did in the video, but after compilation it says "out of bounds", what should I do?...
Hey!
Sounds like you have an array that tries to access something that is outside the lenght of the array. Take a look at the error and it will tell you where the error occour.
There is github to compare your code to
@@KaarinGaming Yeah, thank you a lot😊
16:57
I think it can't work with dynamic map
50th like so please enlighten my brain... Collision works great buttttt, when I spawn in monsters in my game at random locations sometimes they spawn over another monster causing it to get stuck. I swear I have spent multiple hours trying different ideas with my auto spawn system but nodddda luck 🙃
Here's my logic, by default monster collision false in draw method. Then monster checks monster array to see if intersects also is supposed to check if not monster equals monster but it doesn't appear that is the case. It just bypasses this call & sets collision to true when one monster overlaps another. My brain hurts tried even writing a new class with no animation & still no luck.
Time step for me: 8:16
for some reason my collision doesnt works:(
Don't forget you got github/website with the code available and if that doesn't help, there is the discord server.
first
Damm, u were fast!
second
third
forth
sixth