Variable Length Jumps | Coding a 2D Game Engine in Java #50
Вставка
- Опубліковано 10 лип 2024
- Join the Discord: / discord
In this episode I go over a method to create variable length jumps. This method involves counting a certain number of frames, and after enough frames have passed ignoring the player input if they are pressing space. If they stop pressing space early, then we stop applying a jump force. I also scale the jump force linearly so that it runs smoothly and you get the same jump every time if you supply the same input. Next, I go over how to make a block "bop" when Mario hits the bottom of it. I extend this same concept to question blocks, and finally I implement a question block that spits out a coin when Mario hits it.
Code: github.com/codingminecraft/Ma...
0:00 Intro
0:55 Checking if Player is on Ground
4:18 Visualizing the Raycasts
7:51 Creating the Variable Length Jump
14:36 Updating Animations for Jumping
16:24 Stopping Momentum on Collisions
18:56 Bopping Blocks
27:19 Fixing Physics Bug
29:52 Creating the Question Block
34:28 Making a Coin Question Block
---------------------------------------------------------------------
Website: ambrosiogabe.github.io/
Github: github.com/ambrosiogabe
Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)
My Recommended Game Engine Books:
Game Engine Architecture: www.gameenginebook.com/
Game Physics Cookbook (Read this before the next physics book): www.amazon.com/Game-Physics-C...
Game Physics (Ian Millington): www.amazon.com/Game-Physics-E...
Game Programming Patterns (Free): gameprogrammingpatterns.com/
My Recommended Beginning Game Programming Books:
JavaScript Game Design: www.apress.com/gp/book/978143...
My Recommended Java Books:
Data Structures/Algorithms: www.amazon.com/Data-Structure...
LWJGL (Free, but I haven't read this thoroughly): lwjglgamedev.gitbooks.io/3d-g...
This is precocious, there aren't even tutorials like this to find nowadays.
Keep it up, you deserve way more subs!
Looking forward to go through all theses vídeos!
I am enjoying this series. May this series keep going and keep teaching me new stuffs.
And thanks for making these awesome LWJGL videos.
You just gained yourself a sub. Going to watch this entire series from ep. 0 now
thanks so much for this series so far, the only channel I can find making a 2d game engine
Very good and informative video. Congratulations!
Dude, great video and video series, but I kinda want to see more “How it Works” videos. All on your time, of course. Keep up the great work.
you deserve more views and subs bro.
Thanks V_ :)
I love your content!
Bruh thanks I been trynna see this
Me: Thinking Robert Wadlow is big.
Gabe's Intellij: fucc u
```Java
// Create a new class for the jumping ability
public class PlayerJump {
// Set the maximum height of the jump
public static final int MAX_HEIGHT = 20;
// Create a method for the jumping ability
public void jump(){
// Calculate the current height of the jump
int currentHeight = 0;
while (currentHeight < MAX_HEIGHT) {
currentHeight++;
}
// Make the player jump
System.out.println("The player is now jumping!");
}
}
```
Written by Chatsonic