I was working on a 2D lateral scrolling video game with the main camera following the player and I wanted to add layers to some game objects so that only the player would collide with certain elements.
But when I added the layers and clicked on “Play” to check this actually worked, the player just stayed stuck in the left bound of the scene. I couldn’t move it in the X axis and when I made it jump, it was destroyed after a few seconds. Also, the first enemy was moving outside the bounds of the scene (I couldn’t check if other enemies did the same).
The problem is when I reverted all the changes in layers, everything stayed the same. Everything was just fine before I added the layers and now even without layers this problem persists and I can’t understand why.
I’m fairly new in programming, and although I like to deal with problems so I can learn from them, I have no hint of what to do with this. I’ve got a security copy of this project and I might just keep working on it as if nothing would’ve happened, but I wanna be able to work with layers without it being a problem and having my project spoiled.
Maybe there’s a simple solution for this, but I can’t find it, so I appreciate any help.
Sorry if my English is not correct, I’m not a native speaker. Feel free to correct me. =)
Thanks in advance!
I finally solved my problem, after some hours of frustration. As I thought, the solution was REALLY simple, almost insulting, but I still don’t understand what happened exactly. For some reason, one of the layers (“Player”) was in conflict with the others. I just had to add a new layer (“Player2”) with the exactly same parameters than “Player” and everything worked smoothly. However, every time I’ve had a problem, I’ve come to a solution after or while understanding what was happening. This time I don’t understand why this happened, so if anyone could explain me, I’d appreciate it. =)