1.0.1 • Published 3 years ago
@mrklika/snake v1.0.1
Snake
The classic snake game you know, powered by Angular.
This library was generated with Angular CLI version 13.3.0.
Installation
npm i @mrklika/snake
Usage
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { SnakeModule } from '@mrklika/snake';
import { AppComponent } from './app.component';
@NgModule({
declarations: [ AppComponent ],
imports: [
BrowserModule,
SnakeModule
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
<snake></snake>
Inputs
@Input()
startingPositions: Position[] = [
{ x: 20, y: 20 },
{ x: 30, y: 20 },
{ x: 40, y: 20 }
];
@Input()
boardSize = 300;
@Input()
speed = SpeedOptions.Slow;
@Input()
foodColor = '#61BB45';
@Input()
snakeColor = '#424242';
@Input()
showPoints = true;
Outputs
@Output()
pointsChanged = new EventEmitter<number>();
@Output()
gameStarted = new EventEmitter<boolean>();