0 votes

Im scripting the the input to have different set of inputs for Retropie and keyboard with mouse


func _physics_process(delta):

    direction = Vector3()

    if Input.is_action_just_pressed("fire"):
        if aimcast.is_colliding():
            var b = bullet.instance()
            b.look_at(aimcast.get_collision_point(), Vector3.UP)
            b.shoot = true

    if not is_on_floor():
        fall.y -= gravity * delta

    if Input.is_action_just_pressed("jump") and is_on_floor():
        fall.y = jump

    if Input.is_key_pressed(KEY_W) || if Input.is_joy_button_pressed(12):

        direction -= transform.basis.z

    elif Input.is_key_pressed(KEY_S)|| if Input.is_joy_button_pressed(13):

        direction += transform.basis.z

    if Input.is_key_pressed(KEY_D):
        direction += transform.basis.x
    if Input.is_key_pressed(KEY_A):
        direction -= transform.basis.x
    if if Input.is_joy_button_pressed(14):
        direction -= rotation.x

    elif if Input.is_joy_button_pressed(15):
        direction += rotation.x

    direction = direction.normalized()
    velocity = velocity.linear_interpolate(direction * speed, acceleration * delta) 
    velocity = move_and_slide(velocity, Vector3.UP) 
    move_and_slide(fall, Vector3.UP)

this input

if Input.is_key_pressed(KEY_W) || if Input.is_joy_button_pressed(12):

    direction -= transform.basis.z

has this error

Error parsing expression, misplaced: if

in Engine by (55 points)

1 Answer

+1 vote

You don't want that second if here...

if Input.is_key_pressed(KEY_W) || if Input.is_joy_button_pressed(12):

Instead, that should be:

if Input.is_key_pressed(KEY_W) || Input.is_joy_button_pressed(12):
by (19,238 points)
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.