How stairs work in top down 2D game worlds

Поделиться
HTML-код
  • Опубликовано: 20 сен 2024
  • ⁍ Discord: / discord
    ⁍ Twitter: bit.ly/UnitOfT...
    ⁍ Play: unit.dev/mmo
    ⁍ Github: github.com/uni...
    // Description
    This is a brief overview of how stairs work in top down 2d game worlds. We can make the game look more 3D by simply adding a small Y bias as the player moves up and down stairs, making it look like they are climbing up, when in reality they are only moving diagonal.

Комментарии • 221

  • @voxeledphoton
    @voxeledphoton 3 месяца назад +638

    what's really fun is making a fake z axis that just pushes the drawing up in the direction of the camera angle and making the character angle the same of the camera. then when you perform a jump keep drawing the shadow at the normal position, offset the character in the camera angle direction for the illusion of height off the ground.

    • @UnitOfTimeYT
      @UnitOfTimeYT  3 месяца назад +55

      Yeah I do that for the monsters that jump in my game. works really well!

  • @kingofspades9720
    @kingofspades9720 4 месяца назад +268

    Don’t forget, you can learn from early Zelda games, when you get to the top or bottom of the stairs you can make your character have a “elevated” or “second floor” variable so that the player can’t interact with things or enemies that are on a different floor

    • @blindedjourneyman
      @blindedjourneyman 3 месяца назад +6

      ​@pixels_per_minute trying to learn godot, thx for the tidbit

    • @sazerae
      @sazerae 2 месяца назад +1

      I never even thought about this thanks
      But for example, what if you’re character was an archer? Wouldn’t you want to snipe enemies from there too

    • @kingofspades9720
      @kingofspades9720 2 месяца назад +2

      @@sazerae an easy solution is to have the arrows not be effected by elevation, so the “elevated” variable would only effect the player, so if the player wanted to interact with something it would first check “if not elevated you can press this button” but just make it so that the arrows don’t do that kind of check first, and just use normal collision boxes like normal

  • @NoobieSnake
    @NoobieSnake 11 месяцев назад +478

    Your simplistic character gave me hope on being able to make my own.

    • @Misty_Oceans
      @Misty_Oceans 8 месяцев назад +18

      Yea I wanna make a game but thought I wasn't good enough at art than saw this

    • @hipjoeroflmto4764
      @hipjoeroflmto4764 8 месяцев назад +2

      Trash

    • @sedollee7496
      @sedollee7496 6 месяцев назад +10

      Making a game is very time consuming.

    • @MoaresOliveira
      @MoaresOliveira 4 месяца назад

      ​@@Misty_Oceans you dont need to know art to make your game, there is hundreds maybe thousands of free assets that you can use. Just do it

    • @billywhizz09
      @billywhizz09 3 месяца назад +2

      I still wouldn’t be able to make something like that

  • @aikou2886
    @aikou2886 Год назад +1322

    I'd love to know how this works code-wise.

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +493

      It basically looks like this (though the if statements have a few more possible states because of other inputs and other staircase types): Hoping that YT formats this in a somewhat okay way:
      if playerInput.Left {
      move.X -= speed // move left because we are moving left
      if tile.Floor().Type == TileStairLeft {
      move.Y += speed // move up because we are moving left up a leftward-staircase
      }
      }
      Where playerInput is the player's input state and tile is the tile that the player is currently on

    • @mosthandsomedudeintheworld
      @mosthandsomedudeintheworld Год назад +40

      ​@@UnitOfTimeYTtq ah brather

    • @aikou2886
      @aikou2886 Год назад +21

      @@UnitOfTimeYT Thank you!

    • @theJadeTiger
      @theJadeTiger 8 месяцев назад +20

      ​@@UnitOfTimeYTwhat language do you use? Im new to coding and do not recognise your syntax. I have started GDScript on Godot and this is hard, holy hell.

    • @UnitOfTimeYT
      @UnitOfTimeYT  8 месяцев назад +48

      @@theJadeTiger lol yeah it can definitely be tough when starting out learning to code. I'd recommend not focusing on trying to learn everything an engine or language has to offer, but instead just try to solve individual problems like: 1. How do I get my character to move? 2. How do I get my character to stop moving when they hit walls. 3. etc...
      I'm using a programming language called "Go" (AKA Golang). It's not really a traditional "gamedev language" but I like it.

  • @__-bm5zj
    @__-bm5zj 8 месяцев назад +268

    Yes and no. This visually works but youre going to hobble yourself later down the road. I would keep track of the z position (even though its 2d) and add the height to the y after movement. This way you can keep track of, say, when an enemy swings at you but they're at the bottom of a cliff, you can easily discard collision checks because theyre not on the same z axis

    • @Pie_Mastah
      @Pie_Mastah 7 месяцев назад +50

      I used to do this, but quickly reverted. The problem with this is as the game map expands, it becomes increasingly difficult to debug at certain areas because you have to keep in mind z axis every time. Also placing enemies also becomes a pain for the same reason.
      In the end, it's just more effort than for what it's worth. And if you really want to stop players being hit by enemies from a different layer, just have the hitboxes not affecting if there's a collision between the player and enemy.

    • @samellington8804
      @samellington8804 6 месяцев назад +5

      @@Pie_Mastah Would you mind expanding on how you might have, say, hitbox x not affect hitbox y if it hits hitbox z first?

    • @Pie_Mastah
      @Pie_Mastah 6 месяцев назад +13

      @@samellington8804 Sure. In Game Maker Studio 2 for example, there's a function that lets you check a line collision between two points.
      So you would then write it as, "if there is no ledge collision on the line between player and enemy coordinates, apply hit box"
      Not sure if there's a similar function for the physics system though.

    • @samellington8804
      @samellington8804 6 месяцев назад +5

      @@Pie_Mastah Ahhh I see. I use Unity so I'm not sure if there's a similar system or not, but I'll look into it. Thank you!

    • @yoster39
      @yoster39 6 месяцев назад

      It's the difference between zelda and alundra

  • @hamzaahmad564
    @hamzaahmad564 5 месяцев назад +7

    You could go a step further and permanently increase/decrease the player size slightly when going up/down to sell the illusion of vertical movement.

  • @drakewinwest9888
    @drakewinwest9888 4 месяца назад +12

    Never thought about it but that makes perfect sense. It’s just an illusion.

  • @angstydoodles1101
    @angstydoodles1101 9 месяцев назад +12

    That's kind of what I expected, but I wasn't sure. Thanks for explaining

  • @DavidZMediaisAwesome
    @DavidZMediaisAwesome 3 месяца назад +28

    ngl i think the slowdown on the stairs just looks sluggish. maybe if you toned it down a bit it would read better but when i saw it i thought it was a coding mistake

  • @Sabbalab92
    @Sabbalab92 Месяц назад +1

    I still don't know a lick about coding, but I can tell I'm getting better at game design because I knew what you were gonna say before you said it, so that feels pretty good.

    • @iamyourgreatgreatgreatgrea6291
      @iamyourgreatgreatgreatgrea6291 13 дней назад

      You don't have to be an amazing programmer in order to create a good game. If games like Undertale can exist and turn into a success, then why wouldn't you, why wouldn't anybody be able to create something that works out the same?
      And usually games start off as something quite unattractive, then turn into something more attractive as time goes by.
      You can definitely do it mate.

    • @Sabbalab92
      @Sabbalab92 13 дней назад

      @@iamyourgreatgreatgreatgrea6291 Thanks for saying that.
      I've actually made a clone of Pong in Godot since making that comment, so I'm getting there.

    • @iamyourgreatgreatgreatgrea6291
      @iamyourgreatgreatgreatgrea6291 13 дней назад

      @@Sabbalab92 You're welcome, and awesome! As long as you keep making stuff, even if it's clones of other games, you're doing something fun and learn lots of cool stuff! :)

  • @WallNutBreaker524
    @WallNutBreaker524 5 месяцев назад +20

    Very interesting. Wanted to become a Game Dev once, but knew it was difficult so I gave up, but this is pretty nice to watch and learn. 😊

    • @UnitOfTimeYT
      @UnitOfTimeYT  5 месяцев назад +3

      Thanks! Glad you enjoyed!

    • @TheZetaKai
      @TheZetaKai 3 месяца назад +1

      It's never too late to learn. I watched Lazy Dev's Academy and made a basic shmup game in my spare time, and you can, too. You will always become who you believe yourself to be.

    • @WallNutBreaker524
      @WallNutBreaker524 3 месяца назад

      @@TheZetaKai True, true. Thanks for the Encouraging Words. 🥰👌

  • @PerpendicularFlight5
    @PerpendicularFlight5 21 день назад +1

    DELTARUNE completely ignores the existence of stairs and just treats them as flat ground lol

  • @cl0msy
    @cl0msy 11 месяцев назад +11

    i like making them go slightly faster when going down the stairs for realism.

  • @gamingkeepstudios3504
    @gamingkeepstudios3504 11 месяцев назад +5

    Omg thank you. I have been trying to figure this out for days now😂 keep falling through the tile map

  • @JonathanTrevatt
    @JonathanTrevatt 3 месяца назад +2

    The other way that is apparently pretty popular is to fake 2d faking 3d. I.e., use a 3d game engine, but use tricks to make it look like it's 2d. E.g., static camera angle, flat textures, and only a few distinct vertical "levels" that the player can travel between. It's sometimes easier to fake 2d with 3d than it is to fake 3d with. Then, when you want to make it look like you are fak8ng 3d woth 2d, it is almost trivial.

  • @sisoyeliot
    @sisoyeliot 2 месяца назад

    something i noticed is that ur player is going faster when going upstairs and downstairs, i’d normalice that velocity and even multiply it by a slowness factor cuz when going up or downstairs u usually go slower

  • @kinershah464
    @kinershah464 3 месяца назад +2

    Next please: how do collisions work in top-doen 2d game?

  • @BradleyZS
    @BradleyZS 2 месяца назад

    I'd do it all graphically - having XY coordinates of the floor one is on and different screen elevations tied to each floor so when the character walks along a transition cell (with certain axis defined as the connection points to specefic floors) it lerps the character's screen position - just because I'd like the possibility of overlapping floors even if it thought the game wasn't going to need them.

  • @Mikewee777
    @Mikewee777 2 месяца назад

    Do not forget that a 45° diagonal path forces characters to run about 1.4 times faster ( Almost one and a half times).

  • @meatbleed
    @meatbleed 3 месяца назад

    Very helpful to show what it looks like without the y bias

  • @everydaycompress4259
    @everydaycompress4259 Год назад +7

    enter the gungeon has perfect jumping examples :D

    • @pokefire953
      @pokefire953 5 месяцев назад

      Fun fact, gungeon is actually a 3d game designed to look 2d

  • @ShiloBuff
    @ShiloBuff 11 месяцев назад +41

    Would have been nice to have a quick showcase of the code too.

  • @Grymyrk
    @Grymyrk 4 месяца назад +13

    Moving the character up and down on the 2D plane? No this character is stationary, it's the world moving up and down underneath him.

    • @UnitOfTimeYT
      @UnitOfTimeYT  4 месяца назад +7

      He is him. The center of the universe. All matter moves relative to him

  • @krimsonk-9478
    @krimsonk-9478 10 дней назад

    Never wondered until this video but that was interesting nonetheless.

  • @LazyCrit
    @LazyCrit 7 месяцев назад +1

    I hadn't thought about it until i saw this

  • @totoshampoin
    @totoshampoin 3 месяца назад +2

    Now, walk behind the stairs and show us how the immersion breaks

  • @IceForgeOfficial
    @IceForgeOfficial 2 месяца назад

    Love these shorts

  • @the_gaming_master
    @the_gaming_master Год назад +17

    this is useful thanks

  • @P4INKiller
    @P4INKiller 3 месяца назад

    Even simpler is to just have position represented by 3 axes. Your renderer can still be 2D.

  • @goldfish6006
    @goldfish6006 3 месяца назад

    the game paper lily also does this really well

  • @krabulon7575
    @krabulon7575 5 месяцев назад

    yk, id never wondered, but its cool to know for sure

  • @CheeseClickerGame
    @CheeseClickerGame Месяц назад

    Thats very interesting thanks

  • @velvetbutterfly
    @velvetbutterfly Месяц назад

    I wish tutorials like this showed example code or more practical information beyond "this is something people can do"

  • @SuperDupTNT
    @SuperDupTNT 3 месяца назад +2

    If only the developers of Zombies Ate My Neighbors could've learned from this

    • @Mikewee777
      @Mikewee777 2 месяца назад

      " Zombies ate my neighbors"
      had vertically facing escalators .

  • @formal_club
    @formal_club 3 месяца назад

    thank you! ❤ :)

  • @zephadusjoltspark6951
    @zephadusjoltspark6951 4 месяца назад +2

    I think you got your positives and negatives mixed up.
    Negative Y moves up, positive Y moves down.
    As long as the meaning is understandable though, I suppose it doesn't matter.

    • @froxdoggaming3385
      @froxdoggaming3385 4 месяца назад +3

      Not in literally every other game engine than the one you use

    • @zephadusjoltspark6951
      @zephadusjoltspark6951 4 месяца назад +1

      @@froxdoggaming3385 Sure, bud. If I'm the odd one out, name 3 engines where positive Y values go UP on the screen.
      Coordinate 0,0 is always in the top-left.
      Please provide examples of 0,0 at the bottom-left.

  • @mehmeh8883
    @mehmeh8883 4 месяца назад +4

    Now do a jump in top down perspective

  • @AdamsAGD
    @AdamsAGD 9 месяцев назад

    omg im stealing that speed adjustment. TY

  • @shalevforfor5550
    @shalevforfor5550 6 месяцев назад

    Yeah I just saw you walking it without the y and I understand it

  • @Neo-ry3jk
    @Neo-ry3jk Год назад

    This helped a lot thx for posting!

  • @salaheddinechoufi5862
    @salaheddinechoufi5862 7 месяцев назад +2

    please do a tutorial for it, also how to add collisions with Ysort when player move around the stairs, it's really confusing

  • @EnderKroni
    @EnderKroni Год назад +6

    Waiting for the jump tutorial

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +3

      Haha aight I'll try and make one once I implement something that jumps or floats in my game

  • @diariodeumdesenvolvedor
    @diariodeumdesenvolvedor Год назад

    Very useful explanation, thanks!

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +2

      Glad it was helpful! Thanks for watching!

  • @markozovko5135
    @markozovko5135 Год назад

    this is really well made video!

  • @jackmakmorn
    @jackmakmorn Год назад +1

    ... I just unserstood that I think way too much in 3d and 3d games. Thanks for explaining this 🙂

  • @MilometerSpear
    @MilometerSpear Год назад +1

    Supet useful thanks! Gonna try this tomorrow

  • @ShadowZero27
    @ShadowZero27 5 месяцев назад +2

    this would be if the game doesnt recognize things like being underneath or next to things. you would want to keep track of the floor level that the character is so they can walk under the upper floor and go behind thenstairs

    • @UnitOfTimeYT
      @UnitOfTimeYT  5 месяцев назад

      Ah yes. Very true! Thanks for mentioning!

  • @InfoManiaco-v2k
    @InfoManiaco-v2k 9 месяцев назад

    thx dude Im new at this and this is awesome information

    • @UnitOfTimeYT
      @UnitOfTimeYT  9 месяцев назад

      Cool! Glad to hear it helped!

  • @AxZelAnimations30
    @AxZelAnimations30 3 месяца назад

    In the same case I've always been wondering how you would jump off in this situation
    Should there be like an Imaginary Z Axis that calculates the Y Axis while there's also a second Y Axis that actually calculates the jump.

    • @UnitOfTimeYT
      @UnitOfTimeYT  3 месяца назад

      Yeah you can definitely have an imaginary Z axis. Some of my monsters will jump and for that I just move them along a fake z axis. But you can do it that way on your tilemap if you want!

  • @cf6755
    @cf6755 2 месяца назад +1

    i thought that they just added a z variable witch you'd add to the y axis when rendering.

    • @UnitOfTimeYT
      @UnitOfTimeYT  2 месяца назад

      Yeah, It's definitely possible to do it that way. In some cases (like jumping) I just use a fake Z variable, but its convenient to have my tilemap all at one depth (tho it does cause some weird edge cases in some situations)

  • @fongaming101
    @fongaming101 8 месяцев назад

    I still dont know but i love it!

  • @roboticspider4554
    @roboticspider4554 Год назад

    hey this helped a lot thanks!

  • @I_wac
    @I_wac 6 месяцев назад

    my brain is expanding thanks

  • @AuburnKamstra-u8j
    @AuburnKamstra-u8j 2 месяца назад

    So you would make your moving commands into functions and then call those functions in the stairs object so that if a person is both on the stairs and moving they will get a bias in either direction?
    Learning game dev rn and this seems useful to do

    • @UnitOfTimeYT
      @UnitOfTimeYT  2 месяца назад +1

      In my case, I have a movement function on the character. Then inside that function, I check the tilemap to see if the floor tile is a stair. And if the floor is a stair, then I simply add a small bias in the Y-direction to move the player up in the tilmap. Hope that makes sense!

    • @AuburnKamstra-u8j
      @AuburnKamstra-u8j 2 месяца назад

      @@UnitOfTimeYT thank you! That does help

  • @DaveMcIroy
    @DaveMcIroy 2 месяца назад

    Just like I would have guessed.

  • @ProjectGameVault
    @ProjectGameVault Год назад

    Thank you

  • @EVILBUNNY28
    @EVILBUNNY28 2 месяца назад +1

    Ok how about occlusion though? How would you make it so you can walk around the back of the stairs there?

    • @UnitOfTimeYT
      @UnitOfTimeYT  2 месяца назад +1

      The way I did it you wouldn't be able to walk behind the stair tiles, but I have walls on either side that you can walk behind which kind of hide the fact that the stairs are fake. Definitely a tradeoff.

  • @Ginto_O
    @Ginto_O 3 месяца назад

    So we can replace a stais with like idk a wind tunnel and it will look the same
    Or rather idk like floor walk thread thibgs like in airport

  • @georgeotiman4336
    @georgeotiman4336 3 месяца назад

    Pixel tribe styled character :D

  • @happily_blue
    @happily_blue 3 месяца назад +1

    Is this how it works in A Link to the Past too with multiple levels?

    • @UnitOfTimeYT
      @UnitOfTimeYT  3 месяца назад +1

      I'm can't guarantee they did it the same exact way. But if I had to guess they probably did something similar

  • @overratedprogrammer
    @overratedprogrammer 10 дней назад

    What if you have stairs where you go right to climb them? Check if player is colliding with "right or left" stairs?

    • @UnitOfTimeYT
      @UnitOfTimeYT  10 дней назад +1

      Yeah I just have an if statement depending on if the stairs are "left stairs" or "right stairs"

  • @redstonewarrior0152
    @redstonewarrior0152 8 месяцев назад +1

    A simple solution is to do what the 2D Zelda games did. All stairs are oriented north and south and the game keeps track of what "floor" the player is on.

  • @h4rrym00
    @h4rrym00 Год назад +3

    Im thinking about adding this into my game. Do you use some kind of rectangle to represent the stairs, then check if the player is colliding with the stairs and moving? then you could check the x direction and add or minus the y depending which direction?

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +2

      Yeah that's exactly what I do. I use a tilemap, so I just check the tile type of the tile the player is currently on. Then if it is a "stair-left" (like the one in the video), I check if they are going left or right. If they go left I add a little "y-bias", else I subtract the "y-bias"

    • @reevy2468
      @reevy2468 11 месяцев назад

      ​I'm learning to program in gamemaker, I really want to do this, could you help me in any way?@@UnitOfTimeYT

  • @billy6427
    @billy6427 4 месяца назад

    Whats a simple Explanation for 2-D FPS Racers ?
    for ex. F-Zero ,Pole Position etc.

    • @UnitOfTimeYT
      @UnitOfTimeYT  4 месяца назад

      Sorry I'm not super familiar with how those were done!

  • @lucasbird6367
    @lucasbird6367 11 месяцев назад

    Great video! Do you know how to config a rain in isometric view with the rain falling on water pounds for exemple, with that animation of water drops that generate small waves in the water?

    • @UnitOfTimeYT
      @UnitOfTimeYT  11 месяцев назад +1

      Thanks. I haven't had to do that yet, so I'm not sure how good this advice is, but you could probably do something like it with world space rain particles falling in the game, then maybe have a second particle system for the small waves in the ponds. You might even be able to get away leaving the two particle systems uncoordinated, I wonder if people would even notice.

    • @lucasbird6367
      @lucasbird6367 11 месяцев назад

      Great idea, Thanks :))@@UnitOfTimeYT

  • @hananebabaali5111
    @hananebabaali5111 4 месяца назад +1

    But can you please explain the first part were when it going up the stairs it turns slightly up and when it going down it turns slightly down

    • @UnitOfTimeYT
      @UnitOfTimeYT  4 месяца назад +3

      Yeah basically: If the player is going up the stairs, then they are pushing left on their keyboard. Then we basically detect that they are on top of the stairs, and we want to "fake them out" a bit to make it look like they are walking upwards on every stair step. So we move them "up" (kinda like they were pressing left and up on their keyboard at the same time. making them go diagonally). Hope that helps!

    • @hananebabaali5111
      @hananebabaali5111 4 месяца назад +1

      @@UnitOfTimeYT yeah thanks

  • @Oksel997
    @Oksel997 2 месяца назад

    What if you have one staircase going up by going right and one by going left, how do you handle this? are you just creating multiple conditions based on types of tile?

    • @UnitOfTimeYT
      @UnitOfTimeYT  2 месяца назад

      Yeah I have multiple conditions. One for stair left and one for stair right

  • @srx2106
    @srx2106 Месяц назад

    How wpuld it be if im going up to down on the stairs but also going up on the y axis

    • @UnitOfTimeYT
      @UnitOfTimeYT  Месяц назад

      Yeah in that case it looks like they are walking straight right (deepending on how much Y bias you give the stairs), but it still feels normal because it feels like your trying to walk in that direction

  • @snigames
    @snigames 2 месяца назад

    Hi! Is this rule going to work in a normal 2d platformer too? I mean a side scroller, not a top down... seems like it.

    • @UnitOfTimeYT
      @UnitOfTimeYT  2 месяца назад

      In that case the y axis is probably upwards anyway. So I imagine it would. But in that case you might have some downward physics and colliders that you do instead

  • @candyqueenify
    @candyqueenify 8 месяцев назад

    Makes sense

  • @MidvightMirage
    @MidvightMirage 7 месяцев назад

    I wanted to know what that one 2d physics thing with people making particle accelerators is called
    Please anyone tell me

  • @Jesse_Lacerda
    @Jesse_Lacerda 11 месяцев назад

    How'd you do that tile.floor().Type? as an object or did you do something with the tileset?

    • @UnitOfTimeYT
      @UnitOfTimeYT  11 месяцев назад

      For my game I did multiple layers on each tile, so a tile has a floor layer inside of it. Then it possible layers above and below (mostly for decorating the tile). So I just do tile.Floor() to get the floor layer of the tile. Alternatively, you could do multiple tilemaps, one for each layer. I just did it with a single tilemap, so to have layers each tile needs to maintain that info internally.

  • @Kpaxlol
    @Kpaxlol 5 месяцев назад

    What about projectiles hitting the stairs??

    • @UnitOfTimeYT
      @UnitOfTimeYT  5 месяцев назад

      You can basically either have the projectile get destroyed when it collides with a stair, or you can make it go up the stairs like a normal player

  • @ΓιωργοςΠαναγιωτίδης-ω2μ

    But ehat about the y direction stairs (the one that face south or north)?

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +3

      Yeah for that case I just slow the player movement down to make it feel like they are climbing something. But other than that they just keep walking in the same direction.

  • @followeroftheWay210
    @followeroftheWay210 16 дней назад

    How did you get the sword to be animated like that?

    • @UnitOfTimeYT
      @UnitOfTimeYT  16 дней назад +1

      I just place the sword on a circle around the player and rotate it based on the direction the player is aiming. Not super tough, but takes a bit of tweaking to make it look decent.

  • @animesongs3992
    @animesongs3992 10 месяцев назад

    How do you check if player is going up or down the stairs because sometimes there could be stairs on left to move upward amd sometimes stairs are on right to move upward

    • @UnitOfTimeYT
      @UnitOfTimeYT  10 месяцев назад

      So the trick there is to have two types of stairs: StairsLeft and StairsRight. Moving left on a StairsLeft would move you upwards, and moving left on a StairsRight would move you downward.

    • @DamianCentkiewicz
      @DamianCentkiewicz 9 месяцев назад

      @@UnitOfTimeYT but player can change a direction. Also you can make this velocity.y +/- in the script of stairs and it will be working for a player, enemies and NPCs. You must only one check a collision in Area2D, get a node (player/enemy/NPC) and in every frame checking his direction or make a new signals for this. Core scripts like for open world game logic are the best. This one object must working for all types characters

    • @UnitOfTimeYT
      @UnitOfTimeYT  8 месяцев назад

      @@DamianCentkiewicz My game is written in "Go" (the language) not "Godot" (the engine). But every entity that moves on the floor uses the same movement function, so they will all use the same logic of checking the floor they are on before moving.

  • @Sparasemi456
    @Sparasemi456 25 дней назад

    how does the jump works in a top down 2d game?

    • @UnitOfTimeYT
      @UnitOfTimeYT  24 дня назад

      You can kinda do something similar for jumping. but usually its easier to track a separate Z variable (which would be the jump height) then offset the Y based on the Z amount. Adding a shadow below the character on the ground helps a lot for that too!

  • @Mark-te7tq
    @Mark-te7tq Год назад

    I have a question. How do you make it like the player sprite is standing behind the banisters, because the player sprite is jn the front and the stairs (and the banisters) are in the background. But how do videogames make it like the banisters are in the front so you cant see the player? Are the banisters a different sprite that is put in the foreground?

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +3

      Hey, yeah you are exactly right. I have two layers: one background layer which represents the floor tiles everywhere, and one foreground layer which represents all of the objects in the game (walls, people, etc). So the background layer is always drawn below the foreground layer, then when I draw the foreground layer I sort the objects based on where they are positioned in the world. So if you imagine the world is a 2D plane, where the X axis is horizontal and the Y axis is vertical, then I sort them based on where they exist in the Y axis: Essentially you just want to draw things that have a lower Y value in front of the things that have a higher Y value. This is sometimes called depth sorting, you can probably google that term (depth sorting) to get some more detailed information. Good Luck!

    • @Mark-te7tq
      @Mark-te7tq Год назад

      @@UnitOfTimeYT Thank you for your help

  • @GustavRex
    @GustavRex 2 месяца назад

    What if they walk diagonally on the stairs, then?

    • @UnitOfTimeYT
      @UnitOfTimeYT  2 месяца назад

      If they walk diagonally (based on the keyboard presses) then in this system they'd walk diagonally on the stairs.

  • @lolopop_yt
    @lolopop_yt 4 месяца назад +7

    What language is This codes in?

    • @UnitOfTimeYT
      @UnitOfTimeYT  4 месяца назад +2

      The whole game is written in golang. (Aka Go)

    • @noname_2108
      @noname_2108 4 месяца назад +3

      @@UnitOfTimeYTgoolag???

    • @maximvmoutput
      @maximvmoutput 3 месяца назад +2

      I swear i remember seeing this exact comment and video a month ago and i knew i was gonna see this exact comment wtf💀

  • @1menity
    @1menity Год назад

    Wow😮

  • @isobek77
    @isobek77 Год назад

    Bro perfect ❤️.Please Download link please 🙏🙏🥺

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад

      The game is called Mythfall. You can play an early demo here (The game is currently heavily in development, so there may be bugs): mythfall.com/

    • @isobek77
      @isobek77 Год назад

      Thank you 😊

  • @IanisIIM
    @IanisIIM 4 месяца назад

    Tutorial for scratch pls

  • @BeatsLabo
    @BeatsLabo Месяц назад

    Collision

  • @oom9112
    @oom9112 8 месяцев назад

    This can be done with a boolean also

  • @nguyenbao3839
    @nguyenbao3839 Год назад

    so basically, when the character moving up the stairs, the character is moving in the diagonal, right?

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад

      Yep! Basically if the character is moving left on a stair like the one on the video you just change the movement to be diagonal instead of directly left.

  • @binkbonkbones3402
    @binkbonkbones3402 Год назад

    Would you consider partnering up for an isometric mobile and laptop mmo?

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +1

      Appreciate the offer, but I'm currently working on my own game. Best of luck with yours though!

  • @mynameisvelk
    @mynameisvelk 9 месяцев назад

    What engine or coding language is this in?

    • @UnitOfTimeYT
      @UnitOfTimeYT  9 месяцев назад

      This is a homemade engine on top of opengl/webgl2 written in golang!

  • @DieToni206
    @DieToni206 7 месяцев назад

    I have no clue about coding. How do I do it?

  • @Markm8
    @Markm8 4 месяца назад +1

    Mind

  • @thehypotheticalhuman6166
    @thehypotheticalhuman6166 2 месяца назад

    2d just sounds more complicated than 3d

  • @jorgevillarreal2245
    @jorgevillarreal2245 9 месяцев назад

    What if I am already moving diagonally ?

    • @UnitOfTimeYT
      @UnitOfTimeYT  9 месяцев назад +1

      Iirc it looks fine when I tested it. I just apply the y bias on top of the regular movement. The slowdown effect when walking up stairs might make it look a bit more normal

  • @SleepyLeviathan6
    @SleepyLeviathan6 3 месяца назад

    What is a x,y bias?

    • @UnitOfTimeYT
      @UnitOfTimeYT  3 месяца назад +1

      I basically mean to add a little extra movement in the upwards direction (the Y axis)

    • @SleepyLeviathan6
      @SleepyLeviathan6 3 месяца назад

      ​@@UnitOfTimeYT Thanks!

  • @Thebes_S
    @Thebes_S 2 месяца назад

    No idea what "y bias" means

    • @UnitOfTimeYT
      @UnitOfTimeYT  2 месяца назад

      Y meaning: On the Y axis
      Bias meaning: Just add a little bit extra.

  • @ronnieurbano1636
    @ronnieurbano1636 8 месяцев назад

    Wait what this game name

    • @UnitOfTimeYT
      @UnitOfTimeYT  8 месяцев назад

      This is a game I'm making called Mythfall. you can play a demo at: mythfall.com/

  • @Tanjiro-SAN-Kamado
    @Tanjiro-SAN-Kamado 3 месяца назад

    The game name at the start?

    • @UnitOfTimeYT
      @UnitOfTimeYT  3 месяца назад

      This is a game called Mythfall that I'm developing. You can play the prealpha at mythfall.com

    • @Tanjiro-SAN-Kamado
      @Tanjiro-SAN-Kamado 3 месяца назад

      Yoo u actually replied thanks I'll try it!

  • @taro1112
    @taro1112 3 месяца назад

    HOOW

  • @eseehcrosicco
    @eseehcrosicco 2 месяца назад

    I know how this works but i you are trying to teach people you cant just say 'add a bias', nobody knows what that means

  • @YoshimiMilk
    @YoshimiMilk 5 месяцев назад

    Or dont add stairs at all

  • @AkaiKnight
    @AkaiKnight Год назад +9

    Ok now do jumping.

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +2

      haha - don't tempt me!

    • @AkaiKnight
      @AkaiKnight Год назад +2

      @@UnitOfTimeYT I’ve been working on a method to emulate depth from a top down perspective without relying on the illusion of animation
      It’s a tough one 😅😅

    • @UnitOfTimeYT
      @UnitOfTimeYT  Год назад +4

      Yeah that does sound challenging! In the past, to make things look like they're jumping/floating, I've always just placed a drop-shadow at the location of the game object. Then if I want the game object to be jumping/floating, I just move the main sprite upwards, above the shadow. Shadows seem to really help with the human perception of depth. Best of luck!