How to implement moving platforms in a 2D platformer!

  Рет қаралды 586

Matt Hughson

Matt Hughson

Күн бұрын

Here's a look at how I implemented 2D platforms in my NES game, Super Sunny World!
I'm not sure if this is the best way, but it's the way I've found works best for me, and is fast enough to run on the NES.

Пікірлер: 21
@MattHughson
@MattHughson Жыл бұрын
A couple things that might not be clear in the video: 1) The different phases I go through all happen in a SINGLE FRAME *before* rendering. 2) The Update logic and the Rendering logic need to be separate, so that all of the "corrections" shown here happens BEFORE the screen is drawn.
@Satorl
@Satorl Жыл бұрын
finally someone explains this in an understandable way!
@AidinZolghadr
@AidinZolghadr Жыл бұрын
Another lifelong sworn enemy of mine is ladders, would love to see how you would handle ladders. Like how to land in middle of a ladder and catch it, etc.
@AidinZolghadr
@AidinZolghadr Жыл бұрын
How would you handle slopes? I think it's a 10-hour long video haha. Very complex.
@kennyryan4173
@kennyryan4173 8 ай бұрын
Would be nice if you also mixed in the platforms that drop a second after you land on them. Makes for more of a challenge.
@MattHughson
@MattHughson 8 ай бұрын
I actually just implemented that a few days ago!
@theboy181
@theboy181 Жыл бұрын
I want to be your best friend! am I too late? With the flickering line under the game and before the menu, is it possible to hide it better ? anyone figure out a creative way yet?
@MattHughson
@MattHughson Жыл бұрын
Yes it can be hidden. It's very timing specific so I don't want to dig into it until the game is more locked down, and i know the frame timing won't change anymore.
@akaNekete
@akaNekete Жыл бұрын
Thanks for the explanation. Would it be possible to have one video about how you managed the "cutscenes" in your games? (like the ones in “Witch N Wiz” -that are gorgeous-). Thank you 🏖🌞
@MattHughson
@MattHughson Жыл бұрын
Yah, I could! Although, they are pretty hacky! Most of the time it's just a giant hard coded state machine, hand coded to do what I want. I don't have any tools for editing etc.
@akaNekete
@akaNekete Жыл бұрын
@@MattHughson thanks anyway for giving it a thought and for your channel 👍
@esotericsean
@esotericsean Жыл бұрын
I assume the moving platforms are sprites?
@MattHughson
@MattHughson Жыл бұрын
That is correct.
@AidinZolghadr
@AidinZolghadr Жыл бұрын
I honestly don't like outside force moving player freely because for example when an object is attached to the player, it has no idea such thing is happening and may lose a frame, same "order" problem. But I think you'd tackle it in a similar way.
@AidinZolghadr
@AidinZolghadr Жыл бұрын
How the moving platform "know" which objects it's colliding with? Do they get registered when they touch it?
@MattHughson
@MattHughson Жыл бұрын
They simply do an box-to-box collision check. In my case, I update the player first, so I actually cache the platform that play is touching (if any), and then in the update for the platforms, they can quickly say "am I THE platform the player is touching right now" before doing the "move the player" code. However, it could also be that each platform does a collision check with the player in their own updates (prior to moving).
@AidinZolghadr
@AidinZolghadr Жыл бұрын
OMG you went above and beyond and made a video about our chat :)) you're such nice person!
@MattHughson
@MattHughson Жыл бұрын
No problem. I think it's a great topic to share!
@AidinZolghadr
@AidinZolghadr Жыл бұрын
What happens when platform is moving up and player jumps, does it add speed of the platform to it's jump speed? Because if platform is moving fast and player jumps, it would pass the player. (Unless you have CCD!, btw, do you?)
@MattHughson
@MattHughson Жыл бұрын
In my game it does not. It could thought. I think the way I would implement that is rather than having the platform "teleport" the player around, it would set the player's "velocity" to match the platform, so that if the 2 separate, the momentum of the player would be maintained.
@MattHughson
@MattHughson Жыл бұрын
And yes, I do have the problem that if the player is moving faster than the "width/height" of the platform, they can pass through it. This isn't an issue in reality though, due to the constraints of the game. This is not isolated to moving platforms either; it could happen on a static floor if the player is moving faster than 16 pixels per frame.
The Beauty of Parallax
10:23
Video Game Animation Study
Рет қаралды 286 М.
Moving Platforms in GameMaker | Jump-Through / One-Way Platforms
8:56
GameMakerStation - Matharoo
Рет қаралды 17 М.
Man Mocks Wife's Exercise Routine, Faces Embarrassment at Work #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 6 МЛН
когда не обедаешь в школе // EVA mash
00:57
EVA mash
Рет қаралды 3,7 МЛН
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 70 МЛН
I'm making an NES platformer in 2024!
3:54
Matt Hughson
Рет қаралды 3 М.
Super Sunny World Update 11 - Huge Development Milestone!
7:21
Matt Hughson
Рет қаралды 1,9 М.
How I added Ghost Pieces to my Homebrew Game Boy game
11:35
Matt Hughson
Рет қаралды 729
How Isometric Coordinates Work in 2D games
5:23
Jordan West
Рет қаралды 806 М.
Homebrew Games Summer Showcase 2024 (Runtime 34 mins)
34:24
Matt Hughson
Рет қаралды 9 М.
Buy this instead of a Legion Go (X1 Mini Review)
14:36
TechDweeb
Рет қаралды 8 М.
The Wrath of Cortex is Consistently Frustrating
20:31
Penguin in Pyjamas
Рет қаралды 893 М.
Japanese Mario World is VERY Different - Region Break
18:01
Top Gun (NES) Playthrough
29:35
NintendoComplete
Рет қаралды 668 М.
Man Mocks Wife's Exercise Routine, Faces Embarrassment at Work #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 6 МЛН