- Home /
How do you attach enemies to a moving background?
Hello,
I have a (hopefully) quick question. I'm making an arcade shooter like Art in Game's Air Attack. I have some ground enemies in the game. I'm faking collisions by placing the ground enemy hit boxes at the same level as the player. I have triggers that cause these enemies to appear off screen. And a spline system that makes them move across he screen. (I'm using the original Spline Creator tool) Right now, the enemy speed is different than the speed of the scrolling background. The result: it looks like the enemies are 'floating' rather than moving in sync with the background.
Should I try 'parenting' the enemies to the background? What's the best way to have ground enemies that actually look like they're on the ground? Thanks for your insights, if you have any questions, please let me know.
Here's an example of the desired effect: It's a video of Air Attack HD, notice how the enemy tanks come out, and go across the bridge?
Sorry, maybe I should be a bit more clear, design wise, is it good to parent ground enemies to the moving background? The only challenge is, the enemy will already be moving, and be off screen by the time it reaches the player, or it is firing off screen. I can do some type of activate, to make the enemy start moving when the player is in range. Is that a good solution?
From your description, I cannot be sure of your setup. One thing you can try is to move your enemies through Transform.localPosition. I would leave the enemy unparented until it is needed and then parent it to the background when it is activated (using Transform.parent). That way they will not move around until needed, and all movements (or standing still) will be with respect to the moving background when they are active.