Creating a Game
In the Quick Start guide, we learned how to set up a very simple project using dill pixel. Now let’s go through the process of creating a basic game.
Custom Splash Screen
Create an
Splash.ts
file in thesrc
folder. This will be displayed when the game starts. Similar to a Scene, there areadded()
,enter()
andexit()
methods to control how the screen is revealed and hidden. It also contains aupdate()
method that can be used to update the progress of the loading screen, and ahandleLoadProgress()
method that can be used to update the progress of the loading screen. For simplicity’s sake we’re just creating a green background and adding a title that can be clicked to take us to the next screen:In
./dill-pixel-config.ts
, import yourSplash
class:and set the set the
splash
property toyour
dill-pixel.config.ts
should now look like this:in
index.html
, you can remove theloader.css
import, as we’re no longer using it.
Create Scenes
Game Scene
Create a Game.ts
file in the scenes
folder. This will be the main game scene with a few
elements: an image, a title, a message, and a button.
Add the id and debug label to the scene
Clicking on the image will trigger a short animation and increment a counter. Clicking the
button will take us back to StartScene
.
Note that in the destroy()
method we’re cleaning up the gsap
animations.