#How to do a specific type of player movement + sprite changes

1 messages · Page 1 of 1 (latest)

willow egret
#

Hello! I will quickly tell my issue (I am a total noob, I installed Godot some days ago)
I've been trying to search for tutorials about how to do simple things (Like adding animations to my walking) but I've hit an issue. Most tutorials sprites have an up and down while my spritesheet does not.
So I am not sure how to make a walking animation that is something like this:
(When clicking up key, walk up and keep the sprite [either left or right] movement that was used before)
I also saw two main ways of displaying animation, but in one I needed the up and down frames, and the other seemed a bit too overcomplicated?
Sorry again if this is a dumb question, I haven't found an answer (And I'm super new to coding in general)

split oyster
willow egret
merry spruce
#

Are you setting the animation for left and right, or setting x scaling to -1?

willow egret
# merry spruce Are you setting the animation for left and right, or setting x scaling to -1?

I was following this tutorial : https://www.youtube.com/watch?v=pBoXqW4RykE&list=PL3cGrGHvkwn0zoGLoGorwvGj6dHCjLaGd (So I was doing what the guy was doing)

In this series I'm going to be going over everything you need to know in Godot 4 to create your own Godot games so after you can go off and make Godot games on your own. I know you will learn so much from this series and I'm very exited to teach it. In this episode we are going to keep it simple sense it is only episode 1 and create player movem...

▶ Play video
willow egret
merry spruce
#

You can simply start by saying

If input.x > 0
    #play right animation
Elif input.x < 0
    #play left animation
#

I'm on mobile so I'm not sure if the Elif code is correct, but that way moving pure up or down will keep the same facing direction, and up-left, up-right etc works as well

willow egret
#

I'll try it and let you know!!!! Let me do it real quick

merry spruce
#

(of course changing input to whatever you use to get input)

#

Good luck! If you get stuck send a screenshot of or post your code, so we know what we're dealing with

willow egret
#

👍

#

Getting unexpected if in class body u.u

#

I am really new to this sorry again if I make any like, dumb mistakes

#

Oh wait

#

Input with like

#

Hmm

#

Idk if that's the issue I don't think it is

#

But input goes with I not i right

patent forge
#

The class name is capitalized

#

The functions are all lowercase

#

snake_case to be precise

patent forge
#

_process() is a good candidate since it is a graphical thing.

willow egret
#

OIhh thanks!!! Sorry Im really new at this, I gotta go somewhere rn but when I get home I'll try it!

willow egret
#

Gahhh

#

Do I put the Process (void) thing? When I do I get another error

#

Ok I figured something out lemme

willow egret
#

I deleted the things that were giving me an error (bc I don't even understand what could've been) And I still get the error ;;

pearl sentinel
#

obviously the path should be to wherever your animation player actually is, you can just drag it in from the node tree and itll do it automatically

pearl sentinel
#

im still new to godot but im fairly certain thats what tells the script what node its modifying

willow egret
pearl sentinel
#

ping if you cant get it working, im very much still learning but i feel like we can get this

willow egret
#

Lemme try it again bc it's not letting me modify the tree for some reason, giving me an error, I'll watch a video explaining hwo to get it to work and I'll let u know!

patent forge