Climbing up and down a ladder

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bill_rizer900

I am trying to make a game where you climb a ladder up and down.
so far I am using an area 2d and attaching a script to call a function on the player to press a button to ascend the ladder, but the player doesn’t ascend the ladder

Here is the function code:

func climb():
motion.y = 0

 print ('climb')
 
 if Input.is_action_pressed('ui_up'):
    motion.y -= speed
 elif Input.is_action_pressed('ui_down'):
      motion.y += speed
 pass

Any suggestions?

:bust_in_silhouette: Reply From: flurick

Does it print (‘climb’)?
Is the speed set if you print that variable to?
Do you apply your variable motion to the nodes position somewhere?