Game Loop and Key Input - How to Make a 2D Game in Java #2

Channel:
Subscribers:
24,000
Published on ● Video Link: https://www.youtube.com/watch?v=VpH33Uw-_0E



Category:
Tutorial
Duration: 34:48
147,034 views
2,950


(Dec 4, 2022)
The Russian subtitles have been added. Thank you for the help!

Caution: This is a tutorial for Java 2D beginners. So the pacing is slow!

In this video, I will explain how to construct a game loop in detail.

What we do in this video:
1. Draw an object on the screen with Graphics2D
2. Get keyboard input
3. Construct a "sleep" game loop
4. Construct a "delta" game loop
5. Display FPS and check if our game loop is really working.

You might feel it's a bit complicated and constructing a game loop is the first big hurdle in 2D game development so hopefully, this video helps you to get through so we can move on to more fun stuff.

If you have any questions, feel free to leave a comment.

Timestamps:
0:00 Game loop outline
5:30 Draw an object on the screen
8:19 Get keyboard input
17:50 About the system time
21:08 Construct the first game loop (sleep)
28:04 Construct the second game loop (delta)
31:21 Display FPS

#java #javagamedevelopment #java2d







Tags:
java2dtutorial
javagameloop
java2dkeyinput