The obstacle will consist of two parts. There will be an image of an axe that we will rotate around and a base image that the axe will rotate around. The reason we will be controlling the rotation of the axe instead of using another animation is that it would be more complicated to scale Box Collider 2D on the object to always fit the rotating bounds of the axe. Perform the following steps:
To begin with, navigate to the
Assets
folder, right-click on it, select Create and then Folder.Name the folder
Obstacle
and open this folder.Now, right-click on the
Obstacle
folder and click on Import New Asset….Navigate to the
Art
files for the book and open theChapterThree_Obstacle
folder.Then, select
Obstacle_Axe.png
and click on Import.Now, right-click on the
Obstacle
folder again and click on Import New Asset….Select
Obstacle_Axe_Base.png
and click on Import.Select both the imported files in the
Obstacle
folder (click on one and Ctrl + left-click on the other).Now, select Filter...