Next, we'll go back to
PlayState and create instances of our enemies, and then make enemies disappear when they're clicked. Finally, we'll then add to our score every time the player clicks on an enemy.
Before adding functionality, we'll need to import some more classes we'll be using in
import flixel.plugin.MouseEventManager; import flixel.FlxObject; import flixel.util.FlxTimer;
Next, we'll add the new variables we'll need to track:
private var numEnemies:Int = 20; private var score:Int = 0; private var enemyPointValue:Int = 155; private var enemies:Array<Enemy>;
These variables are pretty straightforward:
numEnemies is the number of enemies we'll spawn in the ...