Pixi Slot Machine is a bare minimum slot machine game to get familiar with Pixi.js.
Game parameters are configurable through a configuration file.
$ git clone https://github.com/weyoss/pixi-slot-machine.git
$ cd pixi-slot-machine
$ yarn install
The configuration file index.ts
is located under the config folder and allows you to change for
example the game dimensions (width, height), the number of reels, visible reel cells or to enable/disable the easy mode.
Supported configuration parameters are described by the ConfigInterface
interface.
interface ConfigInterface {
gameWidth: number;
gameHeight: number;
reelsPosition: { x: number; y: number };
buttonPosition: { x: number; y: number };
FPSDisplayPosition: { x: number; y: number };
totalReels: number;
reelSpinningCycles: number;
reelSpinningSpeedFactor: number[];
reelShuffleSpinningSpeedFactor: boolean;
totalReelCells: number;
reelCellHeight: number;
reelCellWidth: number;
reelVisibleCells: number;
reelVerticalPadding: number;
reelHorizontalMargin: number;
}
Game width in pixels.
Game height in pixels.
Position of the reels' container.
Position of the button container.
Position of the FPS display.
Total number of reels.
If you change this parameter you need also to update reelRatationSpeedFactor parameter.
The number of spinning cycles the reels should perform during the animation.
Each reel spins at its own speed. The length of the array is total number of reels.
An array value corresponds to the amount of pixels by which a given reel spins at a time.
Example:
Given [5, 10, 15, 20, 30]
- The first reel will spin by 5px at a time, the second reel will spin by 10px
at a time and so on.
Make reels spin randomly at different speeds each run.
When true
, the order of the reelSpinningSpeedFactor
array elements does not play a role.
Total number of reel cells.
Number of reel cells that are visible in the screen.
Height of a reel cell item in pixels.
Width of a reel cell item in pixels.
Reel top and bottom padding in pixels.
Space between reels in pixels.
$ npm start
$ npm run build
MIT