If you have problem with "CLASS SELECTION SCREEN" remember to put "g2.setColor(new Color(0, 0, 0));" and "g2.fillRect(0,0,gp.screenWidth,gp.screenHeight);" outside "if(titleScreenState == 0)" statement in drawTitleScreen method. Thank you RyiSnow for those precious video!
Every piece of this series is interesting and deserves attention. Let me tell you something that maybe you've been told already: your videos not only are great for those of us who are learning Java, but also they help to put my mind at ease. I don't know if i'm the only one, but your slow and calm pacing is somehow relaxing/relieving! :D Stay well!
Mini map is actually in the plan. You can actually apply the method that we did in this video to create a mini map. Create a buffered image and draw the whole map on it. Then you just need to resize it :)
Hello RyiSnow. You series are great and your calmy voice making it more cool. Its a really interesting to see how making game with out engines. Just from zero point! I was about to question you how to implement one feature but then I just think "Hey, me! What about you do it on yourself ?" and I did it! Because you not only writing code but also explaining it ! Thank you for your videos! Also dont you think to run a parteon or smth like that ?
I'm very happy to hear that. Yeah, thinking by yourself is a very important ability in coding. It helps you greatly to improve your skill and expand possibilities. Keep it up!
To anyone who struggles with dramatic fps drop in full screen I found solution or maybe more of a hack. For full screen stuff I replaced setFullScreen() with this below. No FPS drops. public void setFullScreen() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); double width = screenSize.getWidth(); double height = screenSize.getHeight(); Main.window.setExtendedState(JFrame.MAXIMIZED_BOTH); screenWidth2 = (int) width; screenHeight2 = (int) height; //offset factor to be used by mouse listener or mouse motion listener if you are using cursor in your game. Multiply your e.getX()e.getY() by this. fullScreenOffsetFactor = (float) screenWidth / (float) screenWidth2; }
I'm not that interested in game develpment at all, but still, your videos are really cool. I love to see those stuff being built from scratch. Keep um the good work!
When I did this, when I get to the edge of the map, the game crashes and gives some design problems like: when I open the inventory and close the inventory, it keeps showing up, do you have any idea how to solve it?
Hi RyiS! I'm wondering how to implement animated tiles and weather. For weather, maybe an overlay of animated rain during rainy days or flowing leaves during windy days. I'm also wondering what do you call those?
You are doing a great work in your development. The game is coming to life!! I'm following you from your start. Great Job!! Could I suggest you also at some point in the future to try also JavaFX? I'm using it for small game development and there are more nice features than in the default Swing library without adding complexity.
Glad you enjoy the series! Sorry but JavaFX is not in my plan since I'm not a big fan of it. If I make a tutorial with external libraries/framework I think I would choose LWJGL or LibGdx.
So, after loading the game to the screen, I suffer a lot of performance issues for a while. However, after moving around a bit, the performance picks up back to normal. Is anyone else experiencing this and if so what is their fix?
I love these tutorials! I was wondering though how you'd render a building on the map, like a house or a cave. Is that something you'd layer on top of the completed map or something you'd do tile by tile? I'm thinking the first but don't know how.
You could break up the tile/grid system into two layers. Bottom layer being the terrain layer such as grass, water, dirt, etc. Then have a design layer such as houses, structures, etc, which would be on top of the terrain layer
Hey RyiSnow I was having a problem with my code where When I try and run the game in full screen or when I increase the scale the games FPS tanks to like 40 to 20 and I have tried everything to get it to run faster but nothing has worked. if there is any advice or help you could offer it would be greatly appreciated. I love your videos, they are so comforting and informative.
Yo, your tutorial is so good! Thanks for your job. Is there any other way to make fullscreen? With this code my title screen not working. Screen shows the menu but it's frozen and in the right corner it shows small part of the menu again covering part of "quit" option. When i skipped title screen i could play normaly but drawing time is few times worse.
I have a problem. I changed to the new method nad now the screen isnt repainting. It paints the corrects images and text but isnt changing the past frames. Someone have the same issue?
For everyone who has this problem using the WHILE method to draw the screen. I added this line [g2.clearRect(0, 0, screenWidth2, screenHeight2);] at the begining of the drawToTempScreen method. This fixed the problem
this, clears the screen everytime the method is called in the loop, so rewrites the correct frames. If enyone knows others ways to solve this, it will be great to know ;)
Hellou , i need some help , I implemented full screen and if i started game my fps raise to 160 and my game is too fast ... and when i m in fullscreen mode then fps are so slow and game too .... i dont know ... some advice ? thanks
Hey loving your tutorials yet when I reach the point where paint component is removed and everything is as it is in yours my screen starts up okay with title menu but once going in things are not right as they are overlapping the fighter selection and once in game its flashing black in the game? I'll try to continue / edit out the changes for now.. hopefully you know what is going on?
Hello Ryi, amazing video as always!!! I would like you to develop the functionality when the character runs out of life, some game over screen or something
Not sure if this was answered in a previous video but thought I'd ask first. Is there a way to give Half of a tile collision detection and the other half able to be walked through. Like say you have a shore tile with half sand half water.
it could be like going down a flight of stairs to the basement and defeating a big boss. And do you do a tutorial if you go to a height like a cellar then you have a new background?
After the settings the titleScreenState 1(main title) ---> titleScreenState 2(Select your class!) changing is not happening. (You can see both at the same time) What should I do?
I've filled the screen (fillRect) again after if statement in UI class , in order to reset it. public void drawTitleScreen() { if (titleScreenState == 0) { .... } else if (titleScreenState == 1) { ADDED -----> g2.setColor(new Color(0, 0, 0)); ADDED ------> g2.fillRect(0, 0, gp.SCREEN_WIDTH, gp.SCREEN_HEIGHT);
// CLASS SELECTION SCREEN g2.setColor(Color.white); g2.setFont(g2.getFont().deriveFont(42F)); String text = "Select your class!"; int x = getXforCenteredText(text); int y = gp.TILE_SIZE * 3; g2.drawString(text, x, y); } } Seems to work fine for me now.
Anyone elses screen just black I hate saying somethings wrong but I cant even put a finger on it. Everything looks exactly the same in implementation. I have redone the tutorial 3 times
I've tried to implement this into my game, but it seems like the quality of the screen is much worse than before (the title strings and another sprites look much more pixelated). It also drastically reduces the performance of my game, isn't there a less heavier way to implement full screen?
you can manually add all the new sizes to eevrything instead of redrawing the game twice but it takes awhile so for now I just skipped this and might come back later after reduce drawing time through debug
こんばんは! I have a few questions. How can I add screen transitions? Maybe from the overworld into an NPC home? How can can I add unique music to the title screen? How can I add NPC dialogue sound effects? And how can I add dialogue options for the player? Thank you!
The screen transitions and the dialogue options will be featured in future videos. For playing different sound we've already done many times throughout this series so please check previous videos.
@@RyiSnow ありがとう! Also, i am having a bug with map loading. I Have followed your tutorials but for some reason, my map doesn't change when I edit the world.txt file. Even if I delete the world.txt, the map doesn't change. It just draws the tile assigned to 0 in a to the maxWorldCol and the maxWorldRow. So a 50 x 50 radius. Please help!
Hmm sorry but I'm not so sure since I don't own Mac. If your code is indeed correct, it might be a Mac related issue so maybe you want to google it. I don't think IntelliJ is the problem.
Here's the line for that: gd.setFullScreenWindow(null); It works just fine if you keep the top bar while in full screen but if you have undecorated the JFrame, you cannot restore the top bar unless you recreate the JFrame. We'll handle this full screen on/off function in the next video.
Hi Ryi after to implements this changes, when start the game, the second screen (when you choise a class figther, sorcerer or thief) is off-center with respect to the first screen. But then the game is fine.
We changed the screen ratio so it's only natural that some UI elements jolt out of alignment. As I did for the inventory screen in this video, you need to adjust them so they fit the wider screen.
Hello, I'm having an issue after this video that the game is crashing with the error - Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "image" because "this.tile[tileNum]" is null. It does this whenever I'm at the bottom left area of the map. edit** I'm an idiot I only just realised this was an issue but its one I've had for a long time apparently if you have this make sure you are on the correct map (I assume no one is dumb like me but just in case) be on mapV2
That was so so so good thank you for your videos and please make a video about how to turn our java file from example.java to a example.exe i mean how to create a launcher for our Java program 👍
I sort of created a cutscene in the Farewell 2021 video. I scripted the camera and the characters movement. How you do it is really depends on what kind of cutscene you create. Basically you need to script what you want to do on the screen. Creating a class for that would be handy.
I tried to switch to tempScreen but somehow I cannot change it successfully. I think I need to skip this part. Also, I still keep with stop moving the camera at the edge of map. For now, I can build a jar file without any big problem.
I'll drop this code for anyone who finds this useful. The purpose of this code is to prevent the game from slowing down in case of the FPS drops (basically it goes like into slow motion) or speeding up if FPS goes past a certain point. public void run() { long lastTime = System.nanoTime(); long currentTime; double delta = 0; double updateInterval = 1.0 / FPS; long timer = 0; int drawCount = 0; while (gameThread != null) { currentTime = System.nanoTime(); delta += (currentTime - lastTime) / 1000000000.0; // Convert nanoseconds to seconds lastTime = currentTime; while (delta >= updateInterval) { // Update update(); delta -= updateInterval; } // Draw drawToAlteredScreen(); // Draw game into buffered image drawToScreen(); // Draw buffered image to screen drawCount++; if (keyH.showDebugText && (System.nanoTime() - timer) >= 1000000000) { currentFPS = drawCount; drawCount = 0; timer = System.nanoTime(); } } }
Also regarding a previous comment abt map changing I figured it out what I did was remake the map tile class and .ovd the player according to the map spawn and made a door clàss
Hey RyiSnow, i have an issue with the full screen: when my game is in full screen, my graphics card takes over and the whole game speeds up a lot (player go faster, Counters go faster...)in addition to unstable fps, high then low... how can i fix that ? thanks in advance My code: @Override public void run(){ // FPS = 60; // final double drawInterval = 1000000000/FPS; double drawInterval = 1000000000/FPS; double delta = 0; long lastTime = System.nanoTime(); long currentTime; long timer = 0; int drawCount =0; while(gameThread != null){ currentTime = System.nanoTime(); delta += (currentTime - lastTime) / drawInterval; timer += (currentTime - lastTime); lastTime = currentTime;
Thank you RyiSnow for awesome videos! They have helped me so much to understand Java better. Looking forward to your following videos. My game became so slow when I changed it to full screen. It is because of the Java drivers and for me it helped when I added the following line to Main.java before window = new JFrame(); System.setProperty("sun.java2d.d3d", "false");
If you have problem with "CLASS SELECTION SCREEN" remember to put "g2.setColor(new Color(0, 0, 0));" and "g2.fillRect(0,0,gp.screenWidth,gp.screenHeight);" outside "if(titleScreenState == 0)" statement in drawTitleScreen method. Thank you RyiSnow for those precious video!
Every piece of this series is interesting and deserves attention.
Let me tell you something that maybe you've been told already: your videos not only are great for those of us who are learning Java, but also they help to put my mind at ease. I don't know if i'm the only one, but your slow and calm pacing is somehow relaxing/relieving! :D
Stay well!
Haha that wasn't intended but I'm glad to hear that nonetheless!
Was just wondering about full screen implementation, came at the perfect time! Keep up the great work RyiSnow 🔥👊🏻
Nice new video about the best Java Programming Game Tutorial from RyiSnow!! I love it!
I'm thinking about trying to add a mini map, but I don't know how yet, but it's probably going to go. Thanks for a good series
Mini map is actually in the plan. You can actually apply the method that we did in this video to create a mini map. Create a buffered image and draw the whole map on it. Then you just need to resize it :)
@@RyiSnow yes i made it work like that.
my dreams have your voice now
It is so great of you to share this totorial. Thanks a lot!!.
Hello RyiSnow. You series are great and your calmy voice making it more cool. Its a really interesting to see how making game with out engines. Just from zero point!
I was about to question you how to implement one feature but then I just think "Hey, me! What about you do it on yourself ?" and I did it! Because you not only writing code but also explaining it ! Thank you for your videos! Also dont you think to run a parteon or smth like that ?
I'm very happy to hear that. Yeah, thinking by yourself is a very important ability in coding. It helps you greatly to improve your skill and expand possibilities. Keep it up!
To anyone who struggles with dramatic fps drop in full screen I found solution or maybe more of a hack. For full screen stuff I replaced setFullScreen() with this below. No FPS drops.
public void setFullScreen() {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double width = screenSize.getWidth();
double height = screenSize.getHeight();
Main.window.setExtendedState(JFrame.MAXIMIZED_BOTH);
screenWidth2 = (int) width;
screenHeight2 = (int) height;
//offset factor to be used by mouse listener or mouse motion listener if you are using cursor in your game. Multiply your e.getX()e.getY() by this.
fullScreenOffsetFactor = (float) screenWidth / (float) screenWidth2;
}
I thought I ruined my game! Thank you, absolute lad
Thank you so much man
Thanks so much! I was getting a slide show for a game lol
I'm not that interested in game develpment at all, but still, your videos are really cool. I love to see those stuff being built from scratch. Keep um the good work!
That's great to hear! Thank you for the comment :D
When I did this, when I get to the edge of the map, the game crashes and gives some design problems like: when I open the inventory and close the inventory, it keeps showing up, do you have any idea how to solve it?
I'm having the same issue right now.
@@rexroyulada6267 you can solve it? the problem its the screen isnt redrawing
Love your videos! can you add a water animation if you can that would look awesome in the game
Hello RyiSnow, when i run the game, it sets to fullscreen, but its blank and i cant exit from it. Could you help me?
finally im in this part now! the FULLSCREEN MODE!!😍😍😍
Hi RyiS! I'm wondering how to implement animated tiles and weather. For weather, maybe an overlay of animated rain during rainy days or flowing leaves during windy days. I'm also wondering what do you call those?
Yes I wanna do this too
You are doing a great work in your development. The game is coming to life!! I'm following you from your start. Great Job!! Could I suggest you also at some point in the future to try also JavaFX? I'm using it for small game development and there are more nice features than in the default Swing library without adding complexity.
Glad you enjoy the series! Sorry but JavaFX is not in my plan since I'm not a big fan of it. If I make a tutorial with external libraries/framework I think I would choose LWJGL or LibGdx.
So, after loading the game to the screen, I suffer a lot of performance issues for a while. However, after moving around a bit, the performance picks up back to normal. Is anyone else experiencing this and if so what is their fix?
Mine, the tiles on the side are bugging. Changing colors.
I love these tutorials! I was wondering though how you'd render a building on the map, like a house or a cave. Is that something you'd layer on top of the completed map or something you'd do tile by tile? I'm thinking the first but don't know how.
You could break up the tile/grid system into two layers. Bottom layer being the terrain layer such as grass, water, dirt, etc. Then have a design layer such as houses, structures, etc, which would be on top of the terrain layer
@@laxuspoldish6165 I see. Thank you. I'll look into that
Hey RyiSnow I was having a problem with my code where When I try and run the game in full screen or when I increase the scale the games FPS tanks to like 40 to 20 and I have tried everything to get it to run faster but nothing has worked. if there is any advice or help you could offer it would be greatly appreciated. I love your videos, they are so comforting and informative.
Yo, your tutorial is so good! Thanks for your job. Is there any other way to make fullscreen? With this code my title screen not working. Screen shows the menu but it's frozen and in the right corner it shows small part of the menu again covering part of "quit" option. When i skipped title screen i could play normaly but drawing time is few times worse.
Hello RyiSnow, you can teach to us how to implement an Battle System like Final Fantasy I (Turn Based) using this engine?
I'd love to if I have more time!
Hi Ryi, I encountered a problem : the 2nd menu ( fighter, thief, etc) is displayed below the first one .
In method "drawToTempScreen()" first string is "super.paintComponent(graphics2D);". I had the same problem. It helped me. Good luck!)
I have a problem. I changed to the new method nad now the screen isnt repainting.
It paints the corrects images and text but isnt changing the past frames. Someone have the same issue?
For everyone who has this problem using the WHILE method to draw the screen.
I added this line [g2.clearRect(0, 0, screenWidth2, screenHeight2);] at the begining of the drawToTempScreen method. This fixed the problem
this, clears the screen everytime the method is called in the loop, so rewrites the correct frames. If enyone knows others ways to solve this, it will be great to know ;)
@@diegodiaz5787omg thank you so much I was so scared cause when I pressed down to go to like load save or quit game it kept drawing the thing😊
@@Trollycat1822 🤙
@@diegodiaz5787 legend, this fixes everything , huge thanks
Hellou , i need some help , I implemented full screen and if i started game my fps raise to 160 and my game is too fast ... and when i m in fullscreen mode then fps are so slow and game too .... i dont know ... some advice ? thanks
Always I am allowed to reference. May I ask you one question? If checked, the screen will flash black. Do you know what the cause is?
Hi RyiSnow what if my is computer, because when I set up to full screen and my screen is black. What should I change my code to.
So I triple checked, this full screen features totally ruins my game menu and graphics as well(((
Amazing! But there is a bug when you re trying to switch between New game etc
Hi man, i have the same problem, you know how to fix it?
Hey loving your tutorials yet when I reach the point where paint component is removed and everything is as it is in yours my screen starts up okay with title menu but once going in things are not right as they are overlapping the fighter selection and once in game its flashing black in the game? I'll try to continue / edit out the changes for now.. hopefully you know what is going on?
Why does 'GraphicsEnvironment' not resolve? I imported it and there is an error in the list of imports: cannot resolve graphics environment.
yes this helps so much!!!
Hello Ryi, amazing video as always!!!
I would like you to develop the functionality when the character runs out of life, some game over screen or something
Yup the game over screen will be implemented in the near future.
Can you please make the next video on saving and loading the game?
ho man! your videos are amazing!!💕💕
This was really good
Not sure if this was answered in a previous video but thought I'd ask first. Is there a way to give Half of a tile collision detection and the other half able to be walked through. Like say you have a shore tile with half sand half water.
Set a solidArea to the tiles. You'll also need to edit the checkTile method so it can intersect rectangles.
@@RyiSnow ok. I'll try to figure that out
@@greatblackshark9646 Were you able to figure it out? I'm also trying to do something like this
Great video Was always curious on how to go full screen using java built in Graphics class
If you don't want to change the game ratio from 4:3 to 16:9:
public void drawToScreen() {
Graphics g = getGraphics();
// Calculate the aspect ratio
double screenRatio = (double) fullScreenWidth/fullScreenHeight;
double gameRatio = (double) screenWidth/screenHeight;
// Calculate the size of the black bars
int barWidth = 0;
if (gameRatio < screenRatio) {
barWidth = (fullScreenWidth - (int)(fullScreenHeight * gameRatio)) / 2;
}
// Draw the black bars
g.setColor(Color.BLACK);
g.fillRect(0, 0, barWidth, fullScreenHeight); // Left bar
g.fillRect(fullScreenWidth - barWidth, 0, barWidth, fullScreenHeight); // Right bar
// Draw the game screen
g.drawImage(tempScreen, barWidth, 0, fullScreenWidth - 2 * barWidth, fullScreenHeight, null);
g.dispose();
}
please continue with the subtitles/transcript of the video 🥺
They are auto-generated by RUclips. Not by me. I know some videos don't get subtitles but I have no idea why.
@@RyiSnow oh,sorry, didn't know about that part. But it's ok. Thanks for the video.
it could be like going down a flight of stairs to the basement and defeating a big boss. And do you do a tutorial if you go to a height like a cellar then you have a new background?
After the settings the titleScreenState 1(main title) ---> titleScreenState 2(Select your class!) changing is not happening. (You can see both at the same time)
What should I do?
I've filled the screen (fillRect) again after if statement in UI class , in order to reset it.
public void drawTitleScreen() {
if (titleScreenState == 0) {
....
}
else if (titleScreenState == 1) {
ADDED -----> g2.setColor(new Color(0, 0, 0));
ADDED ------> g2.fillRect(0, 0, gp.SCREEN_WIDTH, gp.SCREEN_HEIGHT);
// CLASS SELECTION SCREEN
g2.setColor(Color.white);
g2.setFont(g2.getFont().deriveFont(42F));
String text = "Select your class!";
int x = getXforCenteredText(text);
int y = gp.TILE_SIZE * 3;
g2.drawString(text, x, y);
}
}
Seems to work fine for me now.
@@TheFenzakosu This works on Mac in conjunction with setting BufferedImage.TYPE_INT_ARGB_PRE. Thank you sir!
Anyway, where is the subtitle screen (thief, sorcerer, etc.) ?
What's coming next after this series is finished 👀
I will think about it when this series is done!
tips: mac user can use command+Q to exit, and for anyone else screen is black, try to use BufferedImage.TYPE_INT_ARGB_PRE
THANK YOU SO MUCH, I WAS TRYING TO FIGURE THIS OUT FOR THE PAST 3 DAYS, THANK YOU!
Can you told in which video you change the run method
If possible give link
Anyone elses screen just black I hate saying somethings wrong but I cant even put a finger on it. Everything looks exactly the same in implementation. I have redone the tutorial 3 times
Similar problem here.
Lol same
try to use BufferedImage.TYPE_INT_ARGB_PRE
@@dutianze ok
@@dutianze This works ryi should pin this somehow
Instead of alt+tab and kill, it is posible to close the app using alt+f4 I believe.
I've tried to implement this into my game, but it seems like the quality of the screen is much worse than before (the title strings and another sprites look much more pixelated). It also drastically reduces the performance of my game, isn't there a less heavier way to implement full screen?
you can manually add all the new sizes to eevrything instead of redrawing the game twice but it takes awhile so for now I just skipped this and might come back later after reduce drawing time through debug
@@woodswoody5553 I tried but it doesn't seem to work properly
Maybe Ryi will make another debug video to maintain the integrity of the game while keeping the frame rate good and draw time low
こんばんは! I have a few questions. How can I add screen transitions? Maybe from the overworld into an NPC home? How can can I add unique music to the title screen? How can I add NPC dialogue sound effects? And how can I add dialogue options for the player? Thank you!
The screen transitions and the dialogue options will be featured in future videos. For playing different sound we've already done many times throughout this series so please check previous videos.
@@RyiSnow ありがとう! Also, i am having a bug with map loading. I Have followed your tutorials but for some reason, my map doesn't change when I edit the world.txt file. Even if I delete the world.txt, the map doesn't change. It just draws the tile assigned to 0 in a to the maxWorldCol and the maxWorldRow. So a 50 x 50 radius. Please help!
@@purpleconvict4152 program in the tutorial reads worldV2.txt.
@@Merkuse I fixed this a while ago but thanks for trying to help! :)
I followed the tutorial step by step and everything is equal to yours but my screen is black. Any suggestions? Using MacOs and IntelliJ
Hmm sorry but I'm not so sure since I don't own Mac. If your code is indeed correct, it might be a Mac related issue so maybe you want to google it. I don't think IntelliJ is the problem.
Im running to this issue as well, I think my issue is i am using a 3440 X 1440 monitor.
@@paul7408 similar problem
same issue
When will you post the next video?
Thanks RyiSnow!
Hi RyiSnow do you know what is 5120-by-2880?
What would be the code to make the Full Screen Window back into a normal Sized Window? (Like window.setDefaultSize() or something )
Here's the line for that: gd.setFullScreenWindow(null);
It works just fine if you keep the top bar while in full screen but if you have undecorated the JFrame, you cannot restore the top bar unless you recreate the JFrame. We'll handle this full screen on/off function in the next video.
Hi Ryi after to implements this changes, when start the game, the second screen (when you choise a class figther, sorcerer or thief) is off-center with respect to the first screen. But then the game is fine.
We changed the screen ratio so it's only natural that some UI elements jolt out of alignment. As I did for the inventory screen in this video, you need to adjust them so they fit the wider screen.
I am so immersed rn
Hello, I'm having an issue after this video that the game is crashing with the error - Exception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "image" because "this.tile[tileNum]" is null. It does this whenever I'm at the bottom left area of the map.
edit** I'm an idiot I only just realised this was an issue but its one I've had for a long time apparently if you have this make sure you are on the correct map (I assume no one is dumb like me but just in case) be on mapV2
That was so so so good thank you for your videos and please make a video about how to turn our java file from example.java to a example.exe i mean how to create a launcher for our Java program 👍
You can export it as a jar file.
How to check NPC to NPC collision?
put this in entity class in the update method :
gp.cChecker.checkEntity(this, gp.npc);
Is it just me or the FPS in fullscreen dropped crazy?
For me too
Me too. my draw time without full screen is around 2.8 mill. With full screen it is 5-12 mill
Hey Ryi! いつもお世話ににります!
How could I go about doing a cutscene? Have you experimented with that yet?
宜しくお願い致します。
ケイ
I sort of created a cutscene in the Farewell 2021 video. I scripted the camera and the characters movement. How you do it is really depends on what kind of cutscene you create. Basically you need to script what you want to do on the screen. Creating a class for that would be handy.
Thanks!
I tried to switch to tempScreen but somehow I cannot change it successfully. I think I need to skip this part. Also, I still keep with stop moving the camera at the edge of map.
For now, I can build a jar file without any big problem.
No worries. Full screen is just optional so you can continue the series without this!
@@RyiSnow It seems like it is not hard to implement it, but I cannot achieve it, which makes me feel annoyed.
What is name of this game i want to play
After this update i dont know why but its lagging
Anyone else having screen tearing issues after changing to full screen? Anything that’s out of bounds ends up looking glitched out.
thats what happened to me before, but after following this video my player speed was slowed
Top 👍
I'll drop this code for anyone who finds this useful.
The purpose of this code is to prevent the game from slowing down in case of the FPS drops (basically it goes like into slow motion) or speeding up if FPS goes past a certain point.
public void run() {
long lastTime = System.nanoTime();
long currentTime;
double delta = 0;
double updateInterval = 1.0 / FPS;
long timer = 0;
int drawCount = 0;
while (gameThread != null) {
currentTime = System.nanoTime();
delta += (currentTime - lastTime) / 1000000000.0; // Convert nanoseconds to seconds
lastTime = currentTime;
while (delta >= updateInterval) {
// Update
update();
delta -= updateInterval;
}
// Draw
drawToAlteredScreen(); // Draw game into buffered image
drawToScreen(); // Draw buffered image to screen
drawCount++;
if (keyH.showDebugText && (System.nanoTime() - timer) >= 1000000000) {
currentFPS = drawCount;
drawCount = 0;
timer = System.nanoTime();
}
}
}
Since I am coding in Android Studio, this is unnecessary. Thank you in advance, if I do this in Java!
🥰🥰🥰
That is my computer size.
Pov u asked for this 1:39
Also regarding a previous comment abt map changing I figured it out what I did was remake the map tile class and .ovd the player according to the map spawn and made a door clàss
Hey RyiSnow, i have an issue with the full screen: when my game is in full screen, my graphics card takes over and the whole game speeds up a lot (player go faster, Counters go faster...)in addition to unstable fps, high then low... how can i fix that ? thanks in advance
My code:
@Override
public void run(){
// FPS = 60;
// final double drawInterval = 1000000000/FPS;
double drawInterval = 1000000000/FPS;
double delta = 0;
long lastTime = System.nanoTime();
long currentTime;
long timer = 0;
int drawCount =0;
while(gameThread != null){
currentTime = System.nanoTime();
delta += (currentTime - lastTime) / drawInterval;
timer += (currentTime - lastTime);
lastTime = currentTime;
if(delta >= 1){
update();
drawToTempScreen();
drawToScreen();/
delta--; // -- = -1
drawCount++; // ++ = +1
}
if(timer >= 1000000000){
System.out.println("FPS: " + drawCount);
drawCount = 0;
timer = 0;
}
}
}
@RyiSnow can you give me please your version of GamePanel.java for me the game is not working in half of the video please send me your verison!!!
Thank you RyiSnow for awesome videos! They have helped me so much to understand Java better. Looking forward to your following videos.
My game became so slow when I changed it to full screen. It is because of the Java drivers and for me it helped when I added the following line to Main.java before window = new JFrame();
System.setProperty("sun.java2d.d3d", "false");
i am having the same problem ,i tried your method and its same as it was i am using java 1.8