Now that we've loaded in our pattern data and have a pool for enemies to be spawned from, let's update our
Enemy class to work with movement patterns and allow them to be recycled when they move offscreen or get shot.
To start, open the
Enemy class and add this import:
FlxPoint object is an object that contains the x and y values. We'll be using this class to define each point that the enemy will move to.
Next, let's add the new variables we'll need.
private var movementSpeed:Float; private var movementPattern:Dynamic; private var movementPoints:Array<FlxPoint>;
Here's the explanation of the code:
movementSpeedvariable will store the speed value of ...