Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Qws | |
Old Version | Published before Godot 3 was released. |
extends KinematicBody2D
func _ready():
set_process_input(true)
pass
func _input(event):
if event.type != InputEvent.KEY: return
if event.scancode == KEY_RIGHT and event.is_pressed():
move(Vector2(10,0))
print("moving to Right")
pass
if event.scancode == KEY_LEFT and event.is_pressed():
move(Vector2(-10,0))
print("Moving to Left")
pass
if event.scancode == KEY_UP and event.is_pressed():
move(Vector2(0,-10))
pass
if event.scancode == KEY_DOWN and event.is_pressed():
move(Vector2(0,10))
pass
It’s a child of a Camera Node, and I need to press 10 times left, right ,up or down key to activate. I see nothing in code that says that…?
does it print Moving To … each time you press the button?
keikochan2k1 | 2017-01-30 16:23
Yep… It does says “Moving to…” but it doesn’t move till I pressed it 10 times…
Qws | 2017-01-30 17:15
Do you have anything else running in your scene? Other scripts?
Is it always exactly 10 times or is it random?
Zylann | 2017-01-30 17:20
@Zylann I solved the issue by disabling the drag margin, this caused the camera to not react till I’ve made several steps, which was 10. It seems like it’s fixed on 10, but I guess you can alter it.
Qws | 2017-01-30 17:35
Ah, it’s clear when seeing your scene… that’s a really unfortunate specific case you fell in^^
Zylann | 2017-01-30 18:02