How to Wall Jump in Godot 3.1

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ม.ค. 2025

ความคิดเห็น • 89

  • @grayamirYT
    @grayamirYT 3 ปีที่แล้ว +14

    0:35 When you attempt to reproduce the simple state machine at home and accidentally summoned a demon...

  • @twaldigas
    @twaldigas 5 ปีที่แล้ว +4

    Thank you very much! I tried to implement wall sliding and wall jumping and had the issue that is_on_wall did not worked as I expected it. I always had to press the body against the wall, which you mention in the beginning of your video, to get is_on_wall working. Your solution with the raycasts is awesome! Thanks to this video, I also discovered your state machine. So I spent several hours refactoring my code to work with the state machine and now it is a lot more readable - and wall jumping and sliding is now working as I wanted it to do. Thanks again. Keep up the good work!

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว +3

      Glad I can help! Best thing about a good state machine is it will drastically lower the chance of developing bugs. Thank you for watching, your comment has made my day!

    • @vithor592
      @vithor592 4 ปีที่แล้ว +1

      Well I hate games that make you wall slide even if you're not running against them but to each one their own I guess

  • @GameEndeavor
    @GameEndeavor  5 ปีที่แล้ว +18

    Howdy, everyone! This one was such a hassle, but totally worth it. Thank you for watching! Let me know what you think about the video or if you have any suggestions for other tutorials.

    • @Manfre22
      @Manfre22 5 ปีที่แล้ว +2

      Hey, awesome videos, dude! Been really helpful, especially being new to game development.
      I'm really interested in expanding the use of states, even though it's a bit overwhelming for me atm.
      If you post more videos on advancing the basic movements, that would be great. I really want my characters movement to be satisfying before I start worrying about the other aspects.
      Also, if you shared the project file or had the scripts available for viewing, that would be great. It helps to study when it's all right there.
      (Sorry for the long winded comment lol)
      Thanks again!

    • @webinatic216
      @webinatic216 5 ปีที่แล้ว +2

      I have a technical question. I haven't yet started with Godot so I'm a total newb. I can't motivate myself right now but I will set a goal soon enough. So my question is: Is there a way to have a 3D scene as a background on you 2D game? As Godot has the two separated. Is making a 3D/2D hybrid too complicated(time consuming, engine limitations, etc)?

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว +3

      @@webinatic216 I've never tried it, but I believe you can. No idea what that workflow would be like. I've only ever used 2D in Godot though.

    • @webinatic216
      @webinatic216 5 ปีที่แล้ว +1

      @@GameEndeavor Thanks for the quick answer.

    • @sslaxx
      @sslaxx 5 ปีที่แล้ว +2

      Looking for suggestions, still? How about Sonic-styled loops. MarmitoTH has a version as a poart of github.com/marmitoTH/Godot-Sonic-Physics - I'm curious if you'd use his method or go for another way of implementing it.

  • @renexist5492
    @renexist5492 3 ปีที่แล้ว +1

    I have to say thanks, you are the best godot tutorial source on the web! kuss geht raus

  • @nintenboi926
    @nintenboi926 4 ปีที่แล้ว +9

    I’m planning on making some sort of game mechanic where you blast something (probably Ink) onto walls, which would allow you to stick to the walls. I just think it’d be a very interesting mechanic for a game.

  • @ManiMods
    @ManiMods 2 ปีที่แล้ว +2

    the identifier "move_direction" isn't declared in the current scope. even tho i have it declared in the get_input func?

  • @goldenarts1545
    @goldenarts1545 4 ปีที่แล้ว +6

    Sir please make a 2D ledge grab tutorial. hanging on wall corner tutorial.

    • @JuhoSprite
      @JuhoSprite ปีที่แล้ว

      I would make it with a raycast that is on head level height, and detects if anything is colliding. If nothing is colliding, and u are also in the wall state, u will enter the ldge grab state, and pause any movement until u press jump.

  • @dankjankers6655
    @dankjankers6655 2 ปีที่แล้ว

    I love your videos and I had to comment because I also love your state machine pentacle

  • @lionritchie8201
    @lionritchie8201 11 หลายเดือนก่อน

    Thank you so much for this, I've been feeling like an idiot trying to fix and sort through other examples like Shaggy Dev or Beehave Behaviour Trees.
    This FSM series/solution is so clear and easy to understand; it's incredible! Every other FSM video I've watched has been an absolute mess with broken code examples and half baked hacks(except bitalytic, but he didn't go into much detail).
    edit: seems godot 4 deprecated most of this...would you consider doing an updated version of this series?

  • @wintervein6086
    @wintervein6086 4 ปีที่แล้ว +2

    Can you make a tutorial on how to make our player climb a ledge? Thanks!

  • @xdiatia4197
    @xdiatia4197 4 ปีที่แล้ว

    Just What i was looking for, Wall Jump And Slide!

    • @xdiatia4197
      @xdiatia4197 4 ปีที่แล้ว

      Already subbed before watching the video

  • @wCupOfTea
    @wCupOfTea 5 ปีที่แล้ว +1

    This was helpful, thanks!

  • @tanmaynarayantikam225
    @tanmaynarayantikam225 5 ปีที่แล้ว +1

    This tutorial is Really helpful sir 😃

  • @JasonLothamer
    @JasonLothamer 4 ปีที่แล้ว +1

    Another awesome video! Following along your videos has made my platformers much, much better! Did you ever get around to making the camera work better with wall climbing? Thanks!

    • @GameEndeavor
      @GameEndeavor  4 ปีที่แล้ว +1

      Thank you. :) Glad they're of use to you. I didn't actually, kinda forgot to, lmao. I haven't really worked with wall jumping since this video.

  • @korbsonglotzt
    @korbsonglotzt 2 ปีที่แล้ว

    Awesome thanks

  • @Yoitsme211
    @Yoitsme211 3 ปีที่แล้ว +1

    @GameEndeavor I really love your work and the in depth detail youve put into these videos, as in a short time I have become more familiar with Godot that I dont think could have been done in such a short amount of time. I'd like to ask about your raycast setup, in the `_check_is_valid_wall` you pass wall_raycasts as a parameter but I dont see how this connects to the actual WallRaycast Node as it isnt set anywhere in the script. I ask this because after following your tutorial and also viewing, spending hours reviewing your code and following along with the earlier raycast tutorial, i cannot seem to get raycasting to work at all. its quite frustrating as I feel its probably a simple solution. If I could get help with that, itd be greatly appreciated. Error im currently recieving is `Attempt to call function 'get_children' in base 'null instance' on a null instance`. Thank you.

  • @wolcamophone4783
    @wolcamophone4783 ปีที่แล้ว

    Ok so I have the code for the player state machine from the previous video, but I'm not sure how well it's implemented. It must be working cause if I remove or tweak to call the functions from the parent in the state machine script, the player stops moving. But I digress. I've been following this tutorial and using intuition to implement the code into a 3D controller, and I'd like to say here that as of 4.0 releasing, Character Body 3D now has way more standardized functions to it, so now all you need to set up a function for wall jumping is something like:
    if is_action_pressed("jump") and is_on_wall_only():
    velocity = get_wall_normal() * max_jump_height
    You don't need to spell out as many variables anymore to determine some things, so after a while I lose track of what I'm following here and the code looks like spaghetti by this vid. This guy has such great tutorials too! I wish he would update these to some degree.

    • @lionritchie8201
      @lionritchie8201 11 หลายเดือนก่อน

      agreed. Trying to implement this on godot 4 and it is a bit of a fight.

  • @xthukuh
    @xthukuh 3 ปีที่แล้ว

    This channel is a goldmine for new game developers. Thank you.

  • @doktorceykil
    @doktorceykil 5 ปีที่แล้ว

    is that little guy a weeping angel? 0:46

  • @snstarosciak
    @snstarosciak 5 ปีที่แล้ว +2

    Hey I just discovered your channel in my quest to learn game development :D I was wondering if you have a github repo somewhere that might have some of the starter versions of the code when you start the video so it's a bit easier to follow along? Your channel has some amazing stuff

  • @dynamitch-l7c
    @dynamitch-l7c 3 ปีที่แล้ว

    as a total noob, i'd like to clarify what exactly a constant force of is_on_wall method is (1:00)
    btw, thank you for all of your tutorials! :)

    • @williamle-ed2nk
      @williamle-ed2nk 2 ปีที่แล้ว

      It basically means your character's direction has to be constantly moving toward the wall. If the wall is to your right, then you have to hold right to have constant force. If you let go, then the constant force will stop.

  • @КостяКиндалюк
    @КостяКиндалюк 3 ปีที่แล้ว

    0:33 I thought that only by latin practicing you can accidently summon demon

  • @hanshanserlein576
    @hanshanserlein576 5 ปีที่แล้ว

    You are the real MVP!

  • @cabbie1915
    @cabbie1915 3 ปีที่แล้ว

    the intro music:

  • @Mohamed88Hassan
    @Mohamed88Hassan 2 ปีที่แล้ว

    ty bro , but how can i make a small strong fly to make hit a wall or something ??

  • @SamiAhmed-ri3gj
    @SamiAhmed-ri3gj 4 ปีที่แล้ว

    Wow I just fixed my issue I had earlier with the hero continuing to use the run animation during idle by adding the following line to my code.
    var snap = Vector2.DOWN * 32 if !is_on_floor() else Vector2.ZERO
    *if move_direction == 0 && abs(velocity.x) < SLOPE_STOP:
    velocity.x = 0
    *
    velocity = move_and_slide_with_snap(velocity, snap, Vector2.UP)
    I noticed your note earlier about the lerp function being broken and to use abs but I couldnt put it good use. I got really lucky here but Im glad I got through this hump after being stumped for what seemed like weeks. Now that I have finally implemented the state machine I'm ready to tackle some more of your tutorials.

  • @DashMatin
    @DashMatin 7 หลายเดือนก่อน

    Hello I have a question Question : How to implement a wall stick and slide like in the game Dead Cells. in that game if you jump on wall and don't jump again the character will stick to the wall for a few se c onds then will start to slowly fall and slide but when i try to do the same with if it will go on a loop of is_wall_sliding? yes then sticks to the wall indefinitely how do i tell it to slide and fall after a few seconds? i have a timer but don't know what the logic here should be? can you help me?

  • @dikkiefat9138
    @dikkiefat9138 5 ปีที่แล้ว +1

    hi there, brilliant video :) just wondering if there's a way to let the wall jump feel a bit softer, like the jump from the floor? at the moment mine feels very abrupt which contrasts other gameplay. thanks in advance

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว +1

      Not sure how it would be different. Both jumps work exactly the same. When jumping from the floor, you just set the y velocity immediately and gravity handles the rest, it's the exact same with wall jumping. Unfortunately no, I don't know how to soften the jump, other than to lerp the velocity, to simulate pushing off of the wall. But be careful because that will also make it less responsive. If you're going to do it, then I would do so quickly. Doing it this way would also prevent you from using the physics calculations to set a jump height, so you'd have to tweak it manually.

    • @dikkiefat9138
      @dikkiefat9138 5 ปีที่แล้ว +1

      @@GameEndeavor all right good to know. I'll fiddle around with lerp but otherwise no problem. cheers

  • @kareemfarrag9713
    @kareemfarrag9713 2 ปีที่แล้ว

    How to run on wall for one second then fall or make wall eject?

  • @drozhdofficialtfm3863
    @drozhdofficialtfm3863 5 ปีที่แล้ว +1

    How to make grappling hook please ?

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว +3

      It's on the list of things I would like to cover, I may end up covering it soon.

    • @drozhdofficialtfm3863
      @drozhdofficialtfm3863 5 ปีที่แล้ว +2

      @@GameEndeavor ooh yes :D

  • @AmanSharma-wh2db
    @AmanSharma-wh2db 3 ปีที่แล้ว +1

    is it just me or do you sound like a character from south park (can't remember which character).

  • @erikgiesenloo1871
    @erikgiesenloo1871 3 ปีที่แล้ว

    May I ask how you deploy the state name label?
    I used two dictionaries inside the add_state method of the StateMachine:
    states[state_name] = states.size() + 1 # I am using type-checked funcs, so I am using 0 to denote null - hence why i start counting states from 1.
    state_names[states[state_name]] = state_name

    • @GameEndeavor
      @GameEndeavor  3 ปีที่แล้ว +1

      I get the name from the dictionary by using `states.keys()[state]`

    • @erikgiesenloo1871
      @erikgiesenloo1871 3 ปีที่แล้ว

      @@GameEndeavor Thanks! I didn't know dict was ordered

  • @kaalho2096
    @kaalho2096 4 ปีที่แล้ว +3

    passa o codigo ae

  • @starplatinum5351
    @starplatinum5351 5 ปีที่แล้ว +1

    velocity.x = lerp(velocity.x ,move_speed * move_direction, _get_h_weight())
    It does not work

  • @OpRiverBottoms
    @OpRiverBottoms 5 ปีที่แล้ว

    taking the move_direction out of handle movement just breaks it... Nil... what am i supposed to do?

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว

      move_direction is nil? If so then you need to define it as a class property rather than local to the method.

    • @OpRiverBottoms
      @OpRiverBottoms 5 ปีที่แล้ว +1

      @@GameEndeavor I fixed it, wrong order in state logic. However I have a separate issue I was having before trying to implement wall jumping.
      my code for movement is relatively simple, I left out the dropping through platforms and jump height. Well for some reason my default value for grounded is greater than zero.
      its not increasing either.
      input event is just:
      if [states.idle, states.run].has(state):
      if event.is_action_pressed("jump"):
      parent.velocity.y = parent.jump
      and gravity :
      velocity.y += gravity * delta
      would you have any idea where this default value may be coming from?
      thanks
      edit: by default value i mean its apply a constant value while grounded

  • @Reneator
    @Reneator 5 ปีที่แล้ว

    Cant you use the KinematicBody.onWall() function?
    But i guess a raycast is better if you dont want to have to be glued to the wall to be able to jump off again.

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว +2

      As I said in the video, it requires a constant force being applied on the wall. Which means you can't use `velocity = move_and_slide()` because that will zero out velocity.x when on a wall.
      And even if you removed that then you wouldn't be able to push away from the wall before jumping, unless you lock the wall_direction, which then you run into issues with when `is_on_wall()` is no longer true
      But even with that, raycast gives you more control of what is considered wallslide, otherwise you could be wallsliding with the tippy tips of your toes or by the tuft of your ears. Which looks odd imo.

    • @Reneator
      @Reneator 5 ปีที่แล้ว +1

      @@GameEndeavor Thank you for the thorough explanation!

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว

      @@Reneator Any time. :)

    • @sslaxx
      @sslaxx 5 ปีที่แล้ว

      Was wondering if the "with_snap" variant of move_and_slide would be worth looking at. It uses a Vector2 for snap, so "snap" could in theory be applied to x, y or both.

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว

      @@sslaxx That's an interesting idea. Certainly worth looking into. I suspect a few issues though, but would need to fiddle around with it to know for sure.
      A big one being that you might end up sliding along sloped walls where you would expect to drop off of them. Slopes that would connect a ceiling with a wall, if you get what I mean.

  • @cloverleaf5873
    @cloverleaf5873 4 ปีที่แล้ว

    Please teach me how to make blocks. I still don't know how. Objects that block players like walls and stones.

    • @gamedev4988
      @gamedev4988 3 ปีที่แล้ว

      static object with collsion and sprite

  • @HeatGameDev
    @HeatGameDev 5 ปีที่แล้ว

    yo how did you get the StateLabel to display the players state ?

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว +1

      Assuming you're using the same method of adding states in a dictionary, then you can get their string values with the method `keys()` which returns an array, so using `states.keys()[state]`, you can get the state as a string.

    • @HeatGameDev
      @HeatGameDev 5 ปีที่แล้ว

      @@GameEndeavor Yes Thanks.

  • @rankmayor4076
    @rankmayor4076 5 ปีที่แล้ว

    func _check_is_valid_wall(wall_raycasts):
    for raycasts in wall_raycasts.get_children():
    if raycast. is_colliding():
    var dot = acos(Vector2.UP.dot(raycast.get_collision_normal()))
    if dot > PI * 0.35 && dot < PI * 0.55:
    return true
    error: raycast is not declared in current scope. I have a feeling that I'm not getting this to work anytime soon..

  • @rainingrainy152
    @rainingrainy152 4 ปีที่แล้ว

    when i touch the wall, i can't move anymore?

    • @GameEndeavor
      @GameEndeavor  4 ปีที่แล้ว

      Sounds like your transition out of the wall-slide state is broken.

    • @rainingrainy152
      @rainingrainy152 4 ปีที่แล้ว

      @@GameEndeavor also, do i need 2 raycasts for each side, or is that just a collision helper?
      thanks for responding quick, trying to learn states machines

    • @rainingrainy152
      @rainingrainy152 4 ปีที่แล้ว

      @@GameEndeavor OMG I DID THANK YOU, too me 6 hours tho XD

    • @rainingrainy152
      @rainingrainy152 4 ปีที่แล้ว +1

      @@GameEndeavor for some reason when im wall jumping on the left side of walls, the lerp doesn't work? It only moves me up in a straight line

    • @GameEndeavor
      @GameEndeavor  4 ปีที่แล้ว

      @@rainingrainy152 What lerping on the left side? When you jump? If you move straight up on one side when you jump then probably the wall_direction is wrong (iirc, been a while since I looked at this code). Wall direction is used to determine what direction you jump off of it.

  • @selumielczinege6381
    @selumielczinege6381 5 ปีที่แล้ว +2

    As i see this only works with a state machine.(i figured it out by reading comments)
    i have some problems:
    it's a little confusing that you're using two scripts and switch between them or that what do we actually check (in the _check_is_walid_wall function when multiplying PI).
    And you're also speaking a little fast .(So fast that i'm listening to this video with 0.75% speed)
    last part:
    I expected a video that's knowledge can be used in any situation and can be completed by starting with nothing. (okay i can do this starting from scratch but i have to watch some other videos too and that's a little time consuming)
    Overall:
    i'm not judgeing you or anything , i'm not a hater. i'm just saying that these can be improved if you agree with what i said.(exept maybe tha last part)
    PS: if i spelled something wrong than it's because I'm Hungarian. Keep on doing videos!

    • @GameEndeavor
      @GameEndeavor  5 ปีที่แล้ว +5

      Howdy, thank you for the feedback! Especially since it was given in such a respectful manner. Given how I usually receive feedback, this means a lot to me. :)
      - I state at 0:32 that the code uses a state machine. I make that statement at the beginning of all my videos that require a state machine.
      - Sorry about the flipping back and forth. I tried to streamline it as much as possible, but that's the nature of my particular state machine. It favors readability and a tidy player script over a bulky player script that spans over a thousand lines of code (an issue we're currently having at my dev job. :D ) I had orignally planned to use a little graphic to help convey when we were flipping back and forth but didn't get around to it. This one was especially tough because there are so many small parts and I didn't want to have people blindly building all of the pieces before slotting them together at the end, and then finally understanding what each little thing did. I want my viewers to understand as we build it.
      - I'm working on the speaking fast thing. I'm an introvert that hates talking, and when I do I tend to do so very fast, even in person. I'm getting better though.
      - Pardon me, but I always find this one funny. :) If it's time consuming to have to watch several videos, imagine having to make to make a video from scratch every time. This video took me two weeks (I'm guessing 40+ hours) to make and was the most labor instensive video I've ever made. Had I made it from scratch (or all of my other videos because I do a lot of player controller state machine videos) then it would easily be 40 minutes long and would probably take me several months to produce. It's just not feasable nor do I have any interest in repeating myself when I've already covered the topic. Though I suppose I could make a list of recommended videos to make this one. Usually my goal is to make the videos as their own separate thing. Like, if someone has their own player controller, then I'm hoping they can take the knowledge from this video and apply it to their own player controller, rather than people relying on me to supply all of their code. Another reason I'm against it is because my returning viewers would have to watch me build a player controller and a state machine every video. That would get really old for them quickly.

    • @selumielczinege6381
      @selumielczinege6381 5 ปีที่แล้ว +1

      @@GameEndeavor Wow thanks for the quick response! I saw it and decided to answer but it took me some days for some reason.(#lazyness) You're right with making the videos connected to each other you force me to watch them all if i want to learn from it. This is very good for your marketing. Okay but jokes aside making videos on every topic like the big big youtubers (eg. BlackThornProd) is even a bigger time-waster. Not considering the fact that for some people it doesn't makes enough sense to be able to make the connections in the seperated videos. And as i said earlyer: Keep going!

  • @josuereis6367
    @josuereis6367 4 ปีที่แล้ว

    Incredibly complex!

  • @nairazak_art
    @nairazak_art 4 ปีที่แล้ว

    Ok, no walls then

  • @majomajo36
    @majomajo36 5 ปีที่แล้ว +1

    Where we can downolad this

  • @kartikeysawarbandhe6321
    @kartikeysawarbandhe6321 4 ปีที่แล้ว

    I want to wall run in 3d mode, pls help.