@lemu_kymoh thanks for your help. I have a mistake when I fogot to turn off the comment in another script. I have changed the connect method too and it's work. Actually, it's still delay a bit but I don't think it will become a big problem.
undefined
Dung Nguyen
@Dung Nguyen
Posts
-
-
When I tried to overlap the item and pick up, it will have the error like this image. If I tried to press key many times, it's still pick up the item after delay some second. How can I avoid or fix this issue?
-
discord: @nguyendung22122000
my thread: https://godot.community/topic/65/the-way-disable-the-diagonal-movement-keypress-aw-as-wd-sd-of-the-charater-in-top-down-2d-game -
@sepTN oh, it's cool
-
I have this problem before, and this is my solution, you can reference it. I tested your script too, and it doesn't allow overrides. Maybe you can change it with dictionary method, but I think it good for beginner.
var direction := Vector2.ZERO var move_speed = Vector2() if Input.is_action_pressed("move_right"): direction.x = 1.0 elif Input.is_action_pressed("move_left"): direction.x = -1.0 if direction.x != 0: move_speed.x = SPEED direction.y = 0 elif Input.is_action_pressed("move_up"): direction.y = -1.0 elif Input.is_action_pressed("move_down"): direction.y = 1.0 if direction.y != 0: move_speed.y = SPEED direction.x = 0 move_and_slide(SPEED * direction)
Overlapping item issues?
Overlapping item issues?
Join the _init() User Group - Exclusive for Our First 100 Members!
The way disable the Diagonal movement (keypress AW, AS, WD, SD) of the charater in Top down 2D game!
The way disable the Diagonal movement (keypress AW, AS, WD, SD) of the charater in Top down 2D game!