Galaxy Shooter — Phase II: Core Programming
Day 50— Aspiring Game Creator
2D Game Dev: Galaxy Shooter
Objective: New Enemy Type — New Movement
This new enemy type, the Drone, makes use of the Bezier Curve.
There is no magic, this is all math — being the Software Engineer Google Expert — this is the implementation:
There are four paths, each path is made up of 4 points, 2 control points and 2 smoothing curve points.
The code to create the path allows for more control points, but keeping it simple with 4 makes for a simpler implementation.
Each control point is an empty game. This first path’s Control Points are:
X = -16, Y = -8
X = -16, Y = 0
X = 0, Y = 0
X = 0, Y = -8
The other three finish creating a large square as shown above.
Once a basic path of control points is in place the gizmos allow for manipulation and being able to see the path.
In order to follow the route, the Alien Swarmer is an empty game object with FollowPath class and Enemy class. The Swarmer simply follows the path but still collides with Power-Ups and the Player and takes damage.