0 votes

So i have 2 questions

  1. Im trying to make a platformer but i'd like to get rid of that god awful thing where you go into the ground when you land

  2. I'd like to know if there's a way so when I make these coins drop they can pass through eachother and Not land on eachother but still land on the ground

Examples
http://imgur.com/a/OMXTb

in Engine by (483 points)

I don't know what happens in 1), maybe there is something wrong with your collision objects.
But for 2), I think you can toy with collision masks so coins only enter in collision with the ground but not themselves. Also you would want to give them a second collision shape linked to an Area2D so the player can pick them based on a bigger shape.
(sorry no elaborated answer, I'm going to sleep in a few seconds :p)

There are more ways to implement a platformer than the reference implementation in the tutorial example, and any answers to your first question are going to be fairly specific to that implementation.

But #2 is easy to achieve. Have the coins not exist on any Layer (by default they exist on the first layer) -- this will make it so that nothing collides with them. Then have the coins Mask on the second layer (again those default to the first) -- this means that they'll notice when they collide with anything on the second layer. Then make sure all of the solids you want the coins to collide with exist on Layer 2 in addition to Layer 1, that way they'll stop on the same things that the Player stops on but they won't actually stop on the Player.

Then give each of the coins an Area2D child which has no Layers and Mask 1 (so that it checks for collisions on Layer 1 but nothing checks for collisions against it) and connect its "body_enter" signal to check if they've just entered the Player.

1 Answer

0 votes

It looks to me that you need to set properly collision masks and layers of your coins that need to take the same space with other coins.

by (721 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 Frequently asked questions and 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 [email protected] with your username.