Using the path points in a moving background

Hi,this will be hard for me to explain, i am racking my brain to find a solution…
I’m trying to use the enemy spawner system with the path points in a new project where the player doesn’t move on the x axis but rather the background, but if i speed the movement the enemy’s seems stuck and wont go to the next path point until i move the background back to their location…

it is like im changing the path point position when i move the background and i can find a way to detach the path points position from the backgrounds…any help will be appreciated!!

Hi Yehiel,

Add a few Debug.Logs to your code and log the relevant variables into your Console. This will (hopefully) help you understand what exactly is going on. With meaningful messages, you’ll be able to narrow down the problem.

Hi Nina,

Thank you for the advice, i did try to log things but couldn’t find where is the problem only that in a specific speed of the background everything is OK, but when i add speed as a power-up everything breaks… so i switched to animating the path instead of the points system and it works well :slight_smile:

What I don’t understand is: What does the background have to do with the path? In Rick’s original game, they are two separate things that do not affect each other.

Instead of the player moving, i made the background scroll from side to side (and made it with 3D objects)…

What about the enemies and the waypoints? Do they move relative to the background?

I parented the enemies to the background, so they spawn with it and do the path, i did it so the player could maneuver around the enemies since he is stationary on the X axis.
And it worked fine on a low speed, once i sped things the enemies spawned correctly but could find the rest of the path points, if you move the player to the other side they would try to stick back to the path…

What algorithm do you use for moving the enemies? Have you added a few Debug.Logs to check if the relevant if-conditions get evaluated to true?

This topic was automatically closed after 14 days. New replies are no longer allowed.

Privacy & Terms