Fix bugs and add improvements

This commit is contained in:
schmelczerandras 2020-10-13 12:47:25 +02:00
parent 555be9d602
commit ba4dd5c470
10 changed files with 26 additions and 21 deletions

View file

@ -10,7 +10,7 @@ export class ProjectileView extends ProjectileBase implements ViewObject {
constructor(id: Id, center: vec2, radius: number) {
super(id, center, radius);
this.circle = new Circle(center, radius / 2);
this.light = new CircleLight(center, rgb(1, 0.5, 0), 0.35);
this.light = new CircleLight(center, rgb(1, 0.5, 0), 0.15);
}
public step(deltaTimeInMilliseconds: number): void {}

View file

@ -1,6 +1,6 @@
import { vec2 } from 'gl-matrix';
import { Drawable, Renderer } from 'sdf-2d';
import { CommandExecutors, Id, StoneBase } from 'shared';
import { CommandExecutors, Id, Random, StoneBase } from 'shared';
import { RenderCommand } from '../commands/types/render';
import { Polygon } from '../shapes/polygon';
import { ViewObject } from './view-object';
@ -14,10 +14,12 @@ export class StoneView extends StoneBase implements ViewObject {
constructor(id: Id, vertices: Array<vec2>) {
super(id, vertices);
this.shape = new Polygon(vertices);
this.shape = new Polygon(vertices, Random.getRandom());
}
public step(deltaTimeInMilliseconds: number): void {}
public step(deltaTimeInMilliseconds: number): void {
this.shape.randomOffset += deltaTimeInMilliseconds / 5000;
}
public draw(renderer: Renderer): void {
renderer.addDrawable(this.shape);