The classic snake game you know, powered by Angular.
This library was generated with Angular CLI version 13.3.0.
npm i @mrklika/snake
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>
@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;
@Output()
pointsChanged = new EventEmitter<number>();
@Output()
gameStarted = new EventEmitter<boolean>();