Sitemap

Enemies: Creating the Astroid behavior | Unity 2D

Jul 1, 2021

Objective: Create a rotating effect for our Astroid.

Press enter or click to view image in full size

After placing the Astroid into our scene, make it prefab and create a new script for it. I’m calling mine simply, ‘Astroid’.

To make it rotate, let’s check out how to do this by reviewing the Unity Documentation.

Press enter or click to view image in full size

From the above highlighted, we will use just that. In my Astroid script in the update method I will place the below line of code:

Press enter or click to view image in full size

We now have the desired rotating effect:

Press enter or click to view image in full size

--

--

Chelsea Cruise
Chelsea Cruise

Written by Chelsea Cruise

Unity Developer, Software Engineer, Game Designer, Graphic Artist

No responses yet