Preparing the Fly Enemy GameObject

While we’re creating another enemy, the nested nature of GameObjects on this one will bear more similarity to the moving platform than to the Slime we created earlier. We’ll start by setting it up the same way:

1. Create an empty GameObject and name it “enemyFlyPath.” Give it the same icon as you gave the Slime and place it in the Enemy Layer.

2. Create an empty child GameObject under enemyFlyPath and name it “enemyFly.”

3. With enemyFly selected, click the Add Component button and select Rendering > Sprite Renderer. Set the “Sprite” property to enemies_spritesheet_0.

4. Create an empty child GameObject under enemyFly and name it “triggerDamage.”

5. Add a Circle Collider 2D Component to the triggerDamage GameObject. ...

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.