I am trying to make it go for ever

Godot Version

`4.4.1

Question

`

Could you explain more?

i am trying to make a object move for ever by pressing start(s key)

And right now it does move when you press “start” but it stops when you release the key?

If so, you will have to track if the button has ever been pressed.

var started: bool = false

func _unhandled_input(event: InputEvent) -> void:
    if event.is_action_pressed("start"):
        started = true

func _process(delta: float) -> void:
    if started:
        position.x += -SPEED * delta

Make sure to paste code instead of screenshots

when I do paste it in this happens:
Line 11:Used space character for indentation instead of tab as used before in the file.
Line 12:Used space character for indentation instead of tab as used before in the file.
Line 15:Used space character for indentation instead of tab as used before in the file.
Line 16:Used space character for indentation instead of tab as used before in the file.
func _unhandled_input(event: InputEvent) → void:
if event.is_action_pressed(“start”):
started = true

func _process(delta: float) → void:
if started:
position.x += -SPEED * delta

Don’t paste my code into your project, it’s only an example. That error is exactly as it states, you cannot mix spaces and tab indentation, the sample used spaces as indentation but you prefer tabs.

ok thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.