I can't get an object to react to a key press or anything, while another with a very similar code reacts fine

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BornoutofCorebit
:warning: Old Version Published before Godot 3 was released.

The code that isn’t working is below:

extends RigidBody2D

func _enter_tree():
	set_fixed_process(true)

func _process(delta):
	if Input.is_key_pressed(KEY_SPACE):
		set_mode(0)
:bust_in_silhouette: Reply From: volzhs

set_fixed_process enables to call func _fixed_process(delta)
you need to change _process to _fixed_process

if you want to do it with _process, then call set_process(true) instead of set_fixed_process(true)

it didn’t work

BornoutofCorebit | 2017-11-27 18:25

I can’t help

volzhs | 2017-11-27 20:43

so i re-wrote the code, changed a few things by making it a kinematic body and using your tip and it worked, the same code didn’t work on the other scripting page, but somehow making a new page made it work and idk why.

BornoutofCorebit | 2017-11-27 22:21