Installing the Framework
Make sure you have an up-to-date version of Node.js installed and your current working directory is the one where you intend to create a project. Run the following command in your command line:
“Hello World” Example
The most basic example of a dill pixel game is a simple “Hello World” message. Let’s get started…
Create the Files
First, create a package.json
in your project’s root directory:
"name" : " my-dill-pixel-game " ,
"description" : " Hello World with dill pixel " ,
"author" : " Me<me@myname.com> " ,
Next, create an index.html
file in the root directory:
< meta name = " viewport " content = " width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no " >
< meta name = " mobile-web-app-capable " content = " yes " >
< meta name = " apple-mobile-web-app-capable " content = " yes " >
< title > My dill pixel Game </ title >
< script type = " module " src = " src/index.ts " async defer ></ script >
Create an index.css
file in the src
directory:
Create the remaining files in the src
directory:
import { create } from ' dill-pixel ' ;
import { Application } from ' ./Application ' ;
// Create the application
minSize: { width: 375 , height: 700 },
resolution: Math . max (window . devicePixelRatio , 2 ),
import { Application as DillPixelApplication, TransitionType } from ' dill-pixel ' ;
import { MyScreen } from ' ./state/MyScreen ' ;
import { LoadScreen } from ' ./state/LoadScreen ' ;
export class Application extends DillPixelApplication {
// Register the load screen and define the transition type between states
(globalThis as any ) . __PIXI_APP__ = this ;
this . registerDefaultLoadScreen (LoadScreen);
this . state . defaultTransitionType = TransitionType . TRANSITION_SIMPLE_INTERSTITIAL ;
protected registerStates () : void {
this . state . register (MyScreen);
import { LoadScreen as DillPixelLoadScreen } from ' dill-pixel ' ;
import { Point, Sprite } from ' pixi.js ' ;
// The load screen is simply a black background
export class LoadScreen extends DillPixelLoadScreen {
static NAME : string = ' LoadScreen ' ;
// Create the black background
public init ( pSize : Point ) {
this . _bg = this . add . coloredSprite ( 0x000000 );
// When the screen resizes, resize the background
public onResize ( pSize : Point ) {
this . _bg . width = this . _size . x ;
this . _bg . height = this . _size . y ;
import { State } from ' dill-pixel ' ;
import { Point, Sprite, Text } from ' pixi.js ' ;
import { Application } from ' ../Application ' ;
// This screen displays a green background with a white title
export class MyScreen extends State < Application > {
static NAME : string = ' MyScreen ' ;
// Create the background and add the title
public init ( pSize : Point ) {
this . _bg = this . add . coloredSprite ( 0x33aa66 );
this . _bg . eventMode = ' static ' ;
this . _title = this . add . text ({
fontFamily: ' sans-serif ' ,
// When the screen resizes, resize the background
public onResize ( pSize : Point ) {
this . _bg . width = this . _size . x ;
this . _bg . height = this . _size . y ;
Your project directory should look like this:
package.json index.htmlDirectory src index.css index.ts Application.tsDirectory state
Install the Dependencies
Once you have created the files, install the dependencies:
Start the Dev Server
Build for Production