Make a Pokemon Game in Godot - Animations & Turning (#2)

Поділитися
Вставка
  • Опубліковано 4 лют 2025

КОМЕНТАРІ •

  • @Kair3n
    @Kair3n Рік тому +39

    Solution for the character not to stand still in Godot Engine 4:
    Don't connect the Idle with the Walk, leave everything unconnected, just create the nodes as explained in the video.

    • @d123damin
      @d123damin Рік тому +3

      My god thank you, I had this problem and was confused for how it wasnt working almost went to godot 3 just to make it work.

    • @agro31
      @agro31 Рік тому +2

      THANK YOU! I spent 2 hours finding the solution and find this comment

    • @ronanomalley3562
      @ronanomalley3562 8 місяців тому

      You are the hero the people need

    • @leandrekablan1710
      @leandrekablan1710 3 місяці тому

      BRO ! I don't know you but I love you ToT

  • @treybug10000
    @treybug10000 3 роки тому +9

    I started making a Pokemon-like game in Godot a few months before this series started and I was really stressed out over implementing the movement and map functionality because I wasn't very confident. This came out at the perfect time and I hope you continue with the series. It's a great tutorial.

  • @hass89
    @hass89 3 роки тому +6

    Thanks for the tutorial, it's exactly the perfect pace for me. I've been looking for more end to end videos that cover the full details of a real project.

    • @Arkeve
      @Arkeve  3 роки тому +2

      Glad it was helpful!

  • @azaratowcanica2639
    @azaratowcanica2639 3 роки тому +3

    Arkeve you are seriously a legend! This is a brilliant tutorial! Very thorough and not skipping over confusing aspects. Thanks so much :) HUUUGELLY Appreciated! This series is fire :D

  • @tuckertcs
    @tuckertcs 3 роки тому +31

    I think I improved your walking code!
    One thing that bothers me with a lot of 4D movement is having to only press one direction at a time. If I'm moving down and want to turn left, I have to release down before I can start moving left. In this code, it'll switch to left before you release down (and even revert to moving down if you release left but never released down). It's how pokemon actually works and is a much better feeling and more polished. Here's what I did:
    First I added this function. It essentially gets a stack of the 4 direction keys in the order they were first pressed...
    func _process(delta):
    # Store direction keys in a "stack", ordered by when they're pressed
    if Input.is_action_just_pressed("ui_right"):
    direction_keys.push_back("ui_right")
    elif Input.is_action_just_released("ui_right"):
    direction_keys.erase("ui_right")
    if Input.is_action_just_pressed("ui_left"):
    direction_keys.push_back("ui_left")
    elif Input.is_action_just_released("ui_left"):
    direction_keys.erase("ui_left")
    if Input.is_action_just_pressed("ui_down"):
    direction_keys.push_back("ui_down")
    elif Input.is_action_just_released("ui_down"):
    direction_keys.erase("ui_down")
    if Input.is_action_just_pressed("ui_up"):
    direction_keys.push_back("ui_up")
    elif Input.is_action_just_released("ui_up"):
    direction_keys.erase("ui_up")
    if !Input.is_action_pressed("ui_right") and !Input.is_action_pressed("ui_left") and !Input.is_action_pressed("ui_down") and !Input.is_action_pressed("ui_up"):
    direction_keys.clear()
    Then, in the function...
    func process_player_input():
    Replace the movement lines you had...
    if input_direction.y == 0:
    input_direction.x = int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left"))
    if input_direction.x == 0:
    input_direction.y = int(Input.is_action_pressed("ui_down")) - int(Input.is_action_pressed("ui_up"))
    With this...
    # Get input direction from directional key input stack
    if direction_keys.back() == null:
    input_direction = Vector2.ZERO
    else:
    var key = direction_keys.back()
    if Input.is_action_pressed(key):
    if key == "ui_right":
    input_direction.x = 1
    input_direction.y = 0
    elif key == "ui_left":
    input_direction.x = -1
    input_direction.y = 0
    elif key == "ui_down":
    input_direction.x = 0
    input_direction.y = 1
    elif key == "ui_up":
    input_direction.x = 0
    input_direction.y = -1
    else:
    input_direction = Vector2.ZERO
    What this does is it checks the "stack" of keys and picks the top one. The reason for this, is so that if you press left while holding down, it'll switch to left (in your code I'd have to release down before being able to turn).

    • @tuckertcs
      @tuckertcs 3 роки тому +1

      @The8thZin my bad, add var direction_keys = [] at the top

    • @MrAppleSalad
      @MrAppleSalad 2 роки тому

      Thank you so much! This works so much smoother, though it is giving me some errors. for the line "if direction_keys.back() == null:" it keeps pumping out the error "back: Can't take value from empty array." several times a second. Any ideas?

    • @tuckertcs
      @tuckertcs 2 роки тому

      @@MrAppleSalad Well that if statement is checking if the array is empty, essentially. Maybe Godot changed something or maybe you or I made an error. Double check you have exactly what I have, and if that doesn't work then use some other way to check if the direction_keys array is empty, like direction_keys.count() == 0 or however gdscript does that (can't remember the syntax off the top of my head).

    • @MrAppleSalad
      @MrAppleSalad 2 роки тому

      @@tuckertcs I've definatly got it down the same, and it's not like it crashes or anything it seems to work fine it just gives a bunch of errors. My guess is that you're trying to read the array but instead of it being set to an empty value it's being set to "null", which gives an error as it can't read empty space. Maybe it could be fixed by changing it to some default value? I'm not sure, I'm very novice.

    • @nitr4m12
      @nitr4m12 2 роки тому

      @@MrAppleSalad That can be fixed by checking "direction_keys.size() == 0" instead of "direction_keys.back() == null" under "process_player_input()"

  • @brunoutrera5730
    @brunoutrera5730 3 роки тому +3

    Thank you, it helped me a lot to learn, for me one of the best programming courses. I am from Argentina.

  • @daisymatilda9568
    @daisymatilda9568 3 роки тому

    This tutorial is amazing! Very helpful, thank you for your time on this! :)

  • @Ridley126
    @Ridley126 3 роки тому

    Great tutorials! Looking forward to going throught the rest!

  • @catzenr
    @catzenr 10 місяців тому +1

    So, to anyone who can have the problem of: The character freeze after a turn, you do nt need to leave the nodes separate, just look at the animation and zoom it until you can place the metod to "finish" the turn right in the momento 0.1. I also did change the walk animations to start in 0.1 until 0.8, the snap was 0.1 but i still used the 0.2 separation for the frames

  • @mcKrawll
    @mcKrawll 3 роки тому

    Really good tutorials so far. Thanks!

  • @KaidenXIII
    @KaidenXIII 3 роки тому +6

    Nice, Im looking forward to the combat tutorial, since im trying to recreate an Atlantica Online combat system and the turn based part will help me I think :)

  • @muajin
    @muajin 3 роки тому +1

    There's another godot tutorial guy. I think he was also working on a pokemon style game awhile back. I can't imagine how much time he spent making new monsters.

  • @LeniconDev
    @LeniconDev 2 роки тому +4

    If you got this error: "Can't travel to 'Idle' if state machine is not playing. Maybe you need to enable Autoplay on Load for one of the nodes in your state machine or call .start() first?"
    In _ready(), put "animstate.start("Idle")" and in _physics_process(), put "if animstate.is_playing() == false: return" at the top

    • @Kair3n
      @Kair3n Рік тому +1

      Solution for the character not to stand still in Godot Engine 4:
      Don't connect the Idle with the Walk, leave everything unconnected, just create the nodes as explained in the video.

  • @sethwhite4635
    @sethwhite4635 3 роки тому +6

    What's the best way to change the default direction the sprite is facing? We set it to DOWN as default, but when the game starts, the sprite is facing to the left. I popped anim_tree.set("parameters/Idle/blend_position", Vector2(0,1)) in my _ready() function and that seemed to do the trick

    • @Arkeve
      @Arkeve  3 роки тому +3

      Yup, thats a good way of doing it!

  • @ChristianPircher
    @ChristianPircher 2 роки тому +2

    I don't know if you still answer, but I have a problem with turning. If I spam 2 directions like left and right or up and down the player gets stuck and I can't move. Any solution?
    EDIT: I found the solution and it was the animation tree "turn" not being set with the 3 dot thingy instead of the line

  • @gustavoalmeidadaribeira1740
    @gustavoalmeidadaribeira1740 Рік тому +3

    Im using godot 4.0 and when i create an animation tree in the AnimationNodeState automatically comes with an Start and End Blendspaces which i cant get rid of.I try to connect the start with the Idle blendspace the program just crash.What to do ?

  • @AutMouseLabs
    @AutMouseLabs 3 роки тому +3

    I was wondering what the license on these sprites are? I modified the player sprite to have a female player option but don't want to accidentally violate someone's license (actually kind of funny that I am using art and don't know who it is so it is someone's art like someone's pc from the original Pokemon games). Anyhow these tutorials are very cool. I am hoping to do more of a puzzler than a monster ranching game in the long run and I am learning allot. Thank you!

    • @Arkeve
      @Arkeve  3 роки тому +4

      I did make these sprites, however they are heavily based on Pokemon and in future videos i might be using copyrighted sprites just to get through the features. So probably not safe to use these sprites in your game for copyright reasons.

  • @Jecyn14
    @Jecyn14 Рік тому +1

    I've got the walking animations working except for the walk left always defaults to the walk right animation. Any idea what could cause this?

    • @Jecyn14
      @Jecyn14 Рік тому +3

      If anyone has the same issue, make sure you keep the flipH property on the turn left animation key, and toggle it off that way it overrides the right flipH key

  • @shadowfrost-kz5vo
    @shadowfrost-kz5vo 2 роки тому +1

    i rewatched the video like 4 times to see where i went wrong, my character doesn't do any of the walk animations when he moves, idk why. ._.
    EDIT: found te problem, the script is very case sensitive ._. i wrote Walk instead of walk @_@

  • @stellalandi8687
    @stellalandi8687 2 роки тому +3

    I followed the tutorial step by step and i believe the script Is right but the sprite stays still when i move it :/
    Could someone help?

    • @Kair3n
      @Kair3n Рік тому +3

      Solution for the character not to stand still in Godot Engine 4:
      Don't connect the Idle with the Walk, leave everything unconnected, just create the nodes as explained in the video.

  • @reconespi
    @reconespi 3 роки тому +1

    My character moves tile by tile and I'm not sure why. Thanks in advance for any help.

  • @pokegon100
    @pokegon100 2 роки тому +1

    It's not working for me for some reason. The character keeps facing left while walking in any other direction.

    • @Kair3n
      @Kair3n Рік тому

      Solution for the character not to stand still in Godot Engine 4:
      Don't connect the Idle with the Walk, leave everything unconnected, just create the nodes as explained in the video.

  • @punkysuen
    @punkysuen 2 роки тому

    Thanks for the tutorial! I am using v3.4.4, about 1:20, I see there is another option with defaulted ticked called "Create RESET Track(s)", what does it function? Should I keep it ticked?

    • @CertifiedGameDev
      @CertifiedGameDev 2 роки тому +1

      Not sure if you have gotten a response yet, but RESET track is an identical track that returns the animation back to the beginning as you move scenes in the editor. For example, if you were editing an animation and left it at .5 second mark instead of 0, then during the game it started from .5 and didnt act how you wanted to test. The reset track automatically puts the animation back to the start etc.

    • @punkysuen
      @punkysuen 2 роки тому

      @@CertifiedGameDev Thank you

  • @silenttttttttt
    @silenttttttttt 3 роки тому

    Hey I was wondering how would I create 8 directional movement instead? I'm kinda confused about it thenku for the vid btw :0

  • @Toilettrauma88
    @Toilettrauma88 10 місяців тому

    on line 6, i get the error (6, 1): Unexpected "identifier" in class body. It is written verbatim how you have it.

    • @OMNISHROOM
      @OMNISHROOM 6 місяців тому +1

      In Godot 4, you have to use an "@" sign first, so @onready var , I had the same issue, hope this helps.

  • @darkflamesquirrel
    @darkflamesquirrel 3 роки тому +1

    I'm no gamedev, pulled this tutorial up and followed it out of boredom. Somewhere I made an error but its a funny error because I got everything working.. except when my character moves left he stays facing right so I accidentally programmed him to moonwalk. -hee hee intensifies-
    I don't know if I even want to fix this.

    • @shidflyv2
      @shidflyv2 2 роки тому +1

      my character in all directions

  • @epix4300
    @epix4300 3 роки тому +1

    Script Methods don't show up when I Call Method, help please

    • @Sub2PsyClix
      @Sub2PsyClix 27 днів тому

      im 2 years too late but refresh or save your script

  • @sethwhite4635
    @sethwhite4635 3 роки тому

    great stuff

  • @Henry-fj2zf
    @Henry-fj2zf 3 роки тому

    I can't tell the difference between Turn and Walk , shall we just skip the Turn animation ?

    • @Henry-fj2zf
      @Henry-fj2zf 3 роки тому +2

      oh I see. In pokemon , we 're able to turn in the same spot

  • @shidflyv2
    @shidflyv2 2 роки тому

    my character freezes in a position but keeps moving forward
    solved I only need to activate the animation loop

    • @rokstrogaming7366
      @rokstrogaming7366 2 роки тому

      Bro same problem here with me but it is not solving

    • @shidflyv2
      @shidflyv2 2 роки тому +1

      @@rokstrogaming7366 in animation player

    • @rokstrogaming7366
      @rokstrogaming7366 2 роки тому

      @@shidflyv2 Thanks bro my problem is solved

  • @eddyrouhana4965
    @eddyrouhana4965 3 роки тому

    well i made it step by step and the player is turning but he's not walking I tried to turn him then press the same key to make him walk it didn't work

    • @eddyrouhana4965
      @eddyrouhana4965 3 роки тому

      i fixed the thingy but now i can use one key if I want to press any of the right/left/up/down key I cant press another key I just continue with the one i choosed

    • @CH4YSE
      @CH4YSE 3 роки тому +1

      @@eddyrouhana4965 i just completed the first video, and but the character wont move. do you have a fix?

    • @eddyrouhana4965
      @eddyrouhana4965 3 роки тому

      @@CH4YSE i just didnt do the turn just delete all the turn things

    • @CH4YSE
      @CH4YSE 3 роки тому

      @@eddyrouhana4965 thanks for the reply, but I figured it out, I just mispelled a piece of code 😂😂

  • @alfredkoehne6429
    @alfredkoehne6429 3 роки тому +2

    I fixed the small bug and now he runs way to fast.

    • @sidharthgeorge582
      @sidharthgeorge582 3 роки тому

      If youre using a different sprite you should set the walk_speed to 0.1 to 1.0 you can choose

  • @Pfffffffffffff
    @Pfffffffffffff 3 роки тому

    I am getting "Invalid call. Nonexistent function "travel" in base "Nil" on your line 40

    • @Arkeve
      @Arkeve  3 роки тому

      Hmm, I'm not too sure. Would you paste your code so I can see?

    • @Pfffffffffffff
      @Pfffffffffffff 3 роки тому

      @@Arkeve It's ok, seems as though I had some kind of conflict in the way I had set things up with the code for the player I wrote while watching your video.

  • @travisnielsen9975
    @travisnielsen9975 3 роки тому

    Just so others know, in the first video you called 'func process_player_input' but in this video it is now 'func process_player_movement_input'. Not a big deal whatsoever but it confused me for a second. I can see why you changed the name!

  • @thunder4158
    @thunder4158 3 роки тому

    yesssssssssss

  • @PeliPelaaja
    @PeliPelaaja 3 роки тому

    Sad this was the end.

  • @takoyaki_1i
    @takoyaki_1i 3 роки тому

    engagement

  • @CrawillageDev
    @CrawillageDev 3 роки тому

    I always so something wrong god damit xD

  • @noahgaming2504
    @noahgaming2504 3 роки тому +2

    First