Hey everyone,
cant believe i need help with a simple if statement, so trying hard to go from C# to GDScript, and i do know python ,however the indenting is tough, the code is below and not working, its saying on the ChangeDirection("Right") is saying "Unindent does not match any outer indentation level."
WEELL IT SHOULD!!! its only right under the dang IF statement! ugh python was hard and for some reason C# was easy to pick up... dont know why dont ask... but trying to convert from unity to Godot... but maybe i should stay with unity... and NO!!!! i will not go with godot C#, i tried and believe me... so many things wrong with godot documentation that i presened on this forum and no reply backs, i also asked questions, no reply backs... so i am hoping someone can figure this out to give some hope in me continuing learning Godot or maybe not... below is the code:
extends KinematicBody2D
export (int) var runspeed = 300
export (int) var jumpspeed = -600
export (int) var gravity = 1200
var velocity = Vector2()
var jumping = false
var Direction = "Left"
func ChangeDirection(var Direction):
if Direction == "Left":
getnode( "Sprite" ).setfliph( false )
Direction = "Right"
elif Direction == "Right":
getnode( "Sprite" ).setfliph( true )
Direction = "Left"
func getinput():
velocity.x = 0
var right = Input.isactionpressed('uiright')
var left = Input.isactionpressed('uileft')
var jump = Input.isactionjustpressed('ui_select')
if jump and is_on_floor():
jumping = true
velocity.y = jump_speed
if right:
velocity.x += run_speed
ChangeDirection("Right")
if left:
velocity.x -= run_speed
ChangeDirection("Left")
func physicsprocess(delta):
getinput()
velocity.y += gravity * delta
if jumping and isonfloor():
jumping = false
velocity = moveand_slide(velocity, Vector2(0, -1))