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)
#How to do a specific type of player movement + sprite changes
1 messages · Page 1 of 1 (latest)
just don't play the up animation if you don't have one
There's supposed to be an up animation, it just keeps the same movement than the previous key touched, I am not sure how to implement that (sorry :( )
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...
I believe so, I was doing one scale positive and one scale negative
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
I'll try it and let you know!!!! Let me do it real quick
(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
👍
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
The class name is capitalized
The functions are all lowercase
snake_case to be precise
idk if you figured it out, but the code must be inside a function.
_process() is a good candidate since it is a graphical thing.
OIhh thanks!!! Sorry Im really new at this, I gotta go somewhere rn but when I get home I'll try it!
;;
Gahhh
Do I put the Process (void) thing? When I do I get another error
Ok I figured something out lemme
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 ;;
do you have a reference to the animation at the top? there should be something like
@onready var anim = $Sprite2D/AnimationPlayer
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
okay hold on i just looked and saw line 1 is empty... you still need the extends CharacterBody2D
im still new to godot but im fairly certain thats what tells the script what node its modifying
Added that one!! Let me try applying what u told me
ping if you cant get it working, im very much still learning but i feel like we can get this
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!
_ready() is a call, and it is not inside of a function.