Adding everything to PlayState

We're finally going to put everything together in PlayState and have the new functionalities we created work in unison. To do this, we're going to add our Player object, create a pool of the ExplosionEffect objects, and handle collisions between projectiles and enemies, and between the player and enemies.

In addition, we'll make the background scroll and use the timer to increase variability in the game's score, as mentioned in the previous chapter.

It's a lot to do, so let's get started!

Adding imports

To start, let's add the imports we'll need:

import flixel.group.FlxTypedGroup;
import flixel.addons.display.FlxBackdrop;
import flixel.util.FlxColor;

The new class of note is the FlxBackdrop class. This class is used to ...

Get Haxe Game Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.