Variable Length Jumps | Coding a 2D Game Engine in Java #50 @GamesWithGabe
Variable Length Jumps | Coding a 2D Game Engine in Java #50  @GamesWithGabe
Uploaded June 2021 | Updated September 2026, 3 weeks ago
Join the Discord: discord.gg/4tHeAkxNg7

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/MarioYoutube/tree/0a4a893a7d4cc96f5e0b3f12951921c27715ee8e

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: gameenginebook.com
Game Physics Cookbook (Read this before the next physics book): amazon.com/Game-Physics-Cookbook-Gabor-Szauer/dp/1787123669
Game Physics (Ian Millington): amazon.com/Game-Physics-Engine-Development-Commercial-Grade/dp/0123819768
Game Programming Patterns (Free): gameprogrammingpatterns.com

My Recommended Beginning Game Programming Books:
JavaScript Game Design: apress.com/gp/book/9781430247166

My Recommended Java Books:
Data Structures/Algorithms: amazon.com/Data-Structures-Algorithms-Java-6th-ebook/dp/B00JDRQF8C
LWJGL (Free, but I haven't read this thoroughly): lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content
Variable Length Jumps | Coding a 2D Game Engine in Java #50Separating Axis Theorem EXPLAINED | Coding a 2D Physics Engine in Java #11The State Pattern | Game Engine Concepts #4Transformations | Coding Geometry Dash in Java #7Pillbox Colliders and Player Controllers | Coding a 2D Game Engine in Java #49Moving the Ball | Java Pong Part 6aHow I Debug Graphics Code | Game Engine Concepts #65 YEARS of Game Development | From no Programming Knowledge to thisHow to Debug OpenGL Programs? (Non-zero exit code status, uh oh) | Game Engine Concepts #2How to Raycast Against a Box (OBB) | Coding a 2D Physics Engine in Java #9Adding an Engine Runtime (Play/Stop Buttons) | Coding a 2D Game Engine in Java #39ImGui Docking in Java LWJGL | Coding a 2D Game Engine in Java #28
GamesWithGabe |

Variable Length Jumps | Coding a 2D Game Engine in Java #50

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER