I recently started learning how to make games and I choose my first engine to be Godot. So I picked this tutorial by Brackeys (https://www.youtube.com/watch?v=LOhfqjmasi0) Everything was going great until I started learning to make enemy’s.
First of all when I try to make the enemy move left and right it just goes through the whole map. Lastly sometimes I see a tiny black rectangle appear on top of my enemy for a frame and then disappears.(It also appears when I’m viewing the game scene without actually running the game but the black rectangle doesn’t appear often compared to when I run the game)
I’ve been trying to fix this problem for a while but I honestly have no idea what I’m doing wrong. Any help would be really appreciated, thank you😊
I was going to add a video showing the problem but I can’t since the Godot forums say I’m new user, but you can still view the video through this drive link —> (Help me – Google Drive)
You can also view the project if the video didn’t provide enough detail.
Im not sure about the black bar that appears, but regarding the enemy phasing through the walls: If you want your enemy to collide with walls, it has to be a physicsbody aka a “CharacterBody2D”. But you do the collision-testing with raycasts i guess → you have to make sure the raycast collision_mask has the same layers set as the object its supposed to detect (i assume thats the area2Ds in your level-scene)
I just tried making my enemy a characterbody2d but strangely it still continued to phase through everything. I also tried making the layer of my enemy have the same layer as my player and titlemap, I now could collide with the enemy but it was still phasing through my map