I'm having a hard time with the 8-way movement that the website has under its tutorials

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By joshcreatesgames

So, I haven’t spent much time with Godot. Usually, I use a different engine, but I wanted to try and learn something new. Grow and step outside of my comfort zone.

But for whatever reason, I’m having an issue with what seems to be the simplest thing.

I’m trying to follow the 8-direction movement tutorial that is provided here: 2D movement overview — Godot Engine (3.1) documentation in English

Figured that setting up an object with a simple 8-way movement was a pretty good place to start.

I have set up a KinematicBody2D with two children, a Sprite and a CollisionShape2D, and I have the correct programming added to the script for the movement.

But it’s just not moving. The inputs are mapped. The code is identical. I have both of the children for the Kinematic Body created before adding the script. I have no idea what I’m doing wrong here.

I’ve spent some time trying to figure out what I missed, but I’m not sure.

Somebody know what I’m missing/doing wrong?

Can you share your script and/or a screenshot of your scene tree. It’s very common to see “the code is identical” when it turns out it isn’t. Also, double-check that the inputs you added in the “Input Map” are spelled exactly the same as they are in the script.

kidscancode | 2019-04-15 01:43

:bust_in_silhouette: Reply From: Starconstructor

I just use move_and_slide() or move_and_collide() for KinematicBody2D. You should look that up on the docs, that’s how I learn built in functions. I don’t think velocity even works with KinematicBody2D. You need a Vector2 within either of those functions, and you can store variables similar to your velocity values and input them into the Vector2.

The tutorial in question uses move_and_slide() and a Vector2 for velocity. Advising them to do what is already in the tutorial is not going to solve OP’s problem.

kidscancode | 2019-04-16 00:06