0 votes

I'm trying to make a 2d platform game. My player is Rigidbody2D.
I have a function in player.gd to check if the ground is in group "GROUND", so that player can able to jump:

#ground check
func ground_check():
    if ground_detector.is_colliding():
        var body = ground_detector.get_collider()
        if body.is_in_group("GROUND"):
            return true
        return false

I have added group "GROUND" to a StaticBody2D, and it works. But when I try to add group "GROUND" to a Tileset (even the Tilemap), the player still can't jump.

Can anyone help me?

in Engine by (12 points)

1 Answer

0 votes

If I'm not mistaken, the problem is that the colliding body is the tile itself, so you should add the group "GROUND" to the tiles and not the tileset or the tilemap. Hope this helps!

by (32 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.