The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hi there!

extends KinematicBody2D


const flow = -1
const speed = 10
const maxspeed = 100

var motion = Vector2()

func _physics_process(delta):
    if Input.is_action_just_pressed("down"):
        motion.y += speed
        motion.x += speed + flow

So that my code, and i can press the down button (already configurated in the project setting) but it doesn't do anything... in fact any input button event isn't working at all so i maybe misread something!

Thansk a lot
OublieduChaos

Godot version 3.4.5 stable
in Engine by (18 points)

I don't see anything wrong there, assuming you have the input configured correctly.

What happens if you add a few print statements to the code?

func _physics_process(delta):
    print('inside physics_process')
    if Input.is_action_just_pressed("down"):
        print('inside input event')
        motion.y += speed
        motion.x += speed + flow

Which messages do you see when you run the code?

Also, to be clear. That Input code will only run once per each press of the down binding.

Also, assuming you see the first message (inside physics_process), you'll probably want to remove it from the code as it'll spam your console and make it hard to see the other message. :)

So after erasing the 'inside physics_process'
I see every time an input is made a 'inside input event'
So meaning the input work, i think i'm missing something to make the body move... but i'm more tired everynight and so blocking on this line isn't a good thing to do, so waiting for your answers, and thanks, a lot!

You're going to need to post more code to get any assistance with the movement problem. In the code you've shown so far, you're setting the x and y components on a motion variable, but you don't show where/how that variable is used in the movement code.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.