Godot Version
4.2.2
Question
Hello all,
I was following a ladder tutorial but it was for a game that was in progress and also for Godot 3.5, and in the end the collisions section just got too confusing and could not get in functioning correctly - I am fairly new to Godot and some of the knowledge in the tut was above me.
So, now I am trying it on my own and have run into some problem(s):
So far, I have a scene named “LaddersArea”, went to the Node tab and Groups and called it “ladders”:
And in-game it looks this:
The code I have used for the ladder is this:
extends Area2D
#access to player
@onready var player = $“…/Player”
func _on_body_entered(body):
print(“Ladder area entered”);
#access player setLadder() function
player.setLadder(true);
#pass # Replace with function body.
func _on_body_exited(body):
print(“Ladder area exited”);
player.setLadder(false);
#pass # Replace with function body.
and the code within the player “hero” for the purposes of “using” the ladder is this:
#now creating a var (bool???) to know if hero
#is “on” a ladder initially set to false
var on_ladder: bool = false;
#ladder set function
func setLadder(TFvalue):
on_ladder = TFvalue;
When the player “collides” with the ladder it sets the value to true, and prints the appropriate message, and vice versa, so, that appears to be working correctly.
What I need know is this all that needs to be done before coding movement? And what I need to do the start coding movement up/down the ladder? I don’t want someone to just give me a solution, this is supposed to be a learning exercise, but rather someone to give me a tips/pointers (no C++ pun intended) to get started on coding this. Like for instance, I have no climbing animations for the character I am using, so just looking for something to get the character moving up and down with the “idle” animation playing, handling velocity in the y direction and whether I can use the 2d collision shape with the Ladder as the basis for this. Another problem will be getting off a ladder, a problem for another date .
As always if you can help in anyway here is a big thankyou in advance.
Regards.