Player does not collide with traps

Godot Version

4.2.1 Stable Oficial

Question

Hello people! I need help.
I’m trying to do a very simple game similar to old school megaman, it will be my first big project of my life.

Currently I’m stuck for days in a simple collision detection problem. My character can detect the floor, but doesn’t detect my spike traps!! I’ve tried to put just an Area2d + CollisionShape2D in the scene but he still doesn’t detect and i’m stuck and frustrated.

I created a code that show the name of the body that collided with the player but it shows everything but the traps.

Since I find it easier to you guys see the project for itself, i’m sourcing it here

Hi! *Quick note: When you share a project, you do not need to include the .godot folder, since that folder will be generated locally. It takes Google Drive a while to generate the download if it has a few thousand cached files in the ZIP. :slight_smile: *

To detect a collision between the Area2D attached to the player and the Area2D of the spiketrap, you can use the signal area_shape_entered rather than body_entered.

2 Likes

Area2D is not a “body”. You need to use the area_entered signal to detect it.
edit: ninja’d x)

1 Like

THANKS!!!
My gosh I was stuck for days in this!!! When the game is ready I’ll share here with you guys!

Saved my life!!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.