Learn to code by making a 2D space shooter game.

Suleiman Abdullah
2 min readApr 16, 2022

Objective: Implement Enemy Shields.

In the first step create a bool called is Shield Active and set it to default as true.

In the second step create gameObject for the shield named it the enemy shield.

In the next step drag the shield sprite, as a child of the smart enemy, then animate the shield sprite.

In the next step select a smart enemy, and drag the shield sprite to the inspector.

In the next step, we need to check if is shield active, if so we do nothing and set shield active to false.

we collide with the player
when we get hit by the laser

In the next step, we need to disable our shield sprite when a player collides with us, or if we take a hit by a laser.

In the last step we need to make the smart enemy take one hit, we do this by using the return keyword which means get out of this triggerEnter method and don't proceed with other logic.

Let us see the final result.



Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development