Finally, we will create our player character and the namesake of our game, the Star Walrus! This walrus will also have a two-frame animation loop like the enemies.
Since this is a game that will be playable on both desktop and touch-based platforms, we'll be keeping the walrus controls nice and simple. The walrus will automatically shoot while the player moves it around the screen using the keyboard, mouse, or touch input.
First, let's create the class. In the source folder, make a new class named Player
that extends FlxGroup
:
package; import flixel.group.FlxGroup; class Player extends FlxGroup { public function new() { super(); } }
import flixel.FlxSprite; import AssetPaths; import flixel.group.FlxGroup; import flixel.FlxG; import flixel.tweens.FlxTween; import flixel.tweens.FlxEase; import flixel.util.loaders.TexturePackerData; import flixel.group.FlxTypedGroup; import flixel.util.FlxTimer...