Can someone please tell me why it doesn't work?(it shows the message t the end)

Costin25Costin25 Posts: 5Member
edited November 2018 in 2D
extends KinematicBody2D

const UP = Vector2(0,-1)
var motion = Vector2()

func _physics_process(delta):
    motion.y +=10

    if Input.is_action_pressed("ui_right"):
        motion.x = 100
    elif Input.is_action_pressed("ui_left"):
        motion.x = -100
        motion.x = 0

    if is_on_floor():
        print("On floor.")
        if Input.is_acion_just_pressed("ui_up"):
            motion.y = -400

    move_and_slide(motion, UP)

Invalid call.Nonexistent function 'is_action_just_pressed' in base 'InputDefault'.


  • TwistedTwiglegTwistedTwigleg Posts: 1,000Admin

    Which version of Godot are you using?
    If I recall correctly, is_action_just_pressed was added in Godot 3.0 and is missing from Godot 2.1. If you are using Godot 2.1, then you will need to do some manual checking to detect whether a action was just pressed.

  • Costin25Costin25 Posts: 5Member

    i am using Godot 3.0

  • TwistedTwiglegTwistedTwigleg Posts: 1,000Admin
    Answer ✓

    Oh! I found the issue. It is just a typo, acion instead of action.

    Replace if Input.is_acion_just_pressed("ui_up"): with if Input.is_action_just_pressed("ui_up") and it should work :smile:

  • Costin25Costin25 Posts: 5Member

    it works now , thanks^^

Sign In or Register to comment.