At line 19, your “if” has an extra space. Delete the space so it is at the same indentation as the else and then it should work. 🙂

When you get unexpected indentation errors, look for extra spaces/tabs because Godot is trying to say something does not properly line up.

Edit: oops, I didn’t see DaveTheCoder reply… I think we were writing at the same time. 😅

    9 days later

    Sorry that i answer after over an week and thanks for the answers. But now i have my next problem. I updatet my game to a newer version but it semi broke the game. All the colision boxes are not right an the pixel stuff is not pixel anymore ane my script is just gone. I wanted to work on the project on the old version but i cant transform it in an older version. Is there any fixes for that?

    Did you make a backup before updating your project to the new version?

    Since the title of this post is pretty vague, if you need help with something in Godot, I just wanna say that I've been asking chat gtp a lot of questions and it's been phenomenal. I pose the question as best I can and if it's not a crazy complex request it produces an extremely helpful response. This has saved me so much time googling stuff.

    14 days later

    yes i have a made backup, and i tried it with chat gpd. But i gave me a response that acceleration is writen wrong but i wrote it wright.

    DaveTheCoder i made thast it no lines up with the else, but now if Input.action_just_pressed.... is red.

     extends KinematicBody2D
    
    export(int) var JUMP_FORCE = -130
    export(int) var JUMP_RELEAS_FORCE = -70
    export(int) var MAX_SPEED = 50
    export(int) var ACCELERATION = 10
    export(int) var FRICTION = 10
    export(int) var GRAVITY = 4
    export(int) var ADITIONAL_FALL_GRAVITY = 4
    
    var velocity = Vector2.ZERO
    
    
    func _physics_process(delta):
    	apply_gravity()
    	var input = Vector2.ZERO
    	input.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
    	
    	if input.x == 0:
    		apply_friction() 
    	else:
    		apply_acceleration(input.x)
    		
    	if is_on_floor():
    
    	if Input.is_action_pressed("ui_up"):
    		velocity.y = JUMP_FORCE
    	else:
    	if Input.is_action_just_released("ui_up") and velocity.y < JUMP_RELEAS_FORCE:
    		velocity.y = JUMP_RELEAS_FORCE
    			
    	if velocity.y > 0: 
    		velocity .y += ADITIONAL_FALL_GRAVITY
    
    		
    	velocity = move_and_slide(velocity, Vector2.UP)
    	
    func apply_gravity(): 
    	velocity.y += GRAVITY
    
    func apply_friction():
    	velocity.x = move_toward(velocity.x, 0, FRICTION)
    
    func apply_accaleration(amount):
    	velocity.x = move_toward(velocity.x, MAX_SPEED * amount, ACCELERATION )

      XWing if is_on_floor():

      That if-statement has no body. If the following statements are intended to be its body, they need to be indented.

      how do i intend it? just 4 times space in front of every if and else word or how?

        tab key indents the active line, if multiple lines highlighted then tab indents all the highlighted lines.

        XWing how do i indent it?

        It's easier to use tabs than spaces. Use one tab for each level of indentation. Don't mix tabs and spaces.

        I think most good editors have an option to display tabs via a glyph/icon in the editors.