Enemies detecting Player at start of scene

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

Hi,

I’m new to Godot and have been working on my first platform game.

After designating layers for collision, all my Enemies are detecting Player perfectly when Player is in contact with them, but for some reason at the start of the level, all the enemies detect Player immediately, even though Player is nowhere near any of them.

Is there anything I’m maybe missing or doing wrong?

Thanks guys!

we need more information to help you. Maybe some codesnippets and screenshots would be great. The whole project-folder would be even better :slight_smile:

whiteshampoo | 2021-06-07 11:54

It’s my first project and very experimental, I’ve been following tutorials for the most part. Forgive me if it looks a little unorganized lol but I appreciate all the help, this is a community I’m looking forward to interacting with.

The link is to my drive, please check it out and let me know what you. For some reason any collisions I add are being detected but are not blocking anything as well.

New Game Projectsdfsdfsfdsfsdf – Google Drive

kyle_zyster | 2021-06-07 12:40

:bust_in_silhouette: Reply From: whiteshampoo

Sorry for the late answer,

if you modify line 41 in goomba.gd to

print("side %s" % body.name)

it will tell you, that it ts colliding with the Tilemap, not with the player.


The probably best solution is to add

class_name Player

in KinematicBody2D.gd : line 2 (your player-script)

and change the function in goombe.gd to

func _on_side_checker_body_entered(body):
	if not body is Player:
		return
	print("side %s" % body.name)

hope the answer is not too late…