Add player container
This commit is contained in:
parent
1cd8f5fbe6
commit
b55e927a34
16 changed files with 159 additions and 133 deletions
|
|
@ -8,7 +8,6 @@ import { CharacterTeam } from './character-team';
|
|||
export class CharacterBase extends GameObject {
|
||||
constructor(
|
||||
id: Id,
|
||||
public colorIndex: number,
|
||||
public team: CharacterTeam,
|
||||
public health: number,
|
||||
public head?: Circle,
|
||||
|
|
@ -19,7 +18,7 @@ export class CharacterBase extends GameObject {
|
|||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
const { id, colorIndex, team, health, head, leftFoot, rightFoot } = this;
|
||||
return [id, colorIndex, team, health, head, leftFoot, rightFoot];
|
||||
const { id, team, health, head, leftFoot, rightFoot } = this;
|
||||
return [id, team, health, head, leftFoot, rightFoot];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
export enum CharacterTeam {
|
||||
decla = 'decla',
|
||||
neutral = 'neutral',
|
||||
red = 'red',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ export class PlayerCharacterBase extends CharacterBase {
|
|||
public name: string,
|
||||
public killCount: number,
|
||||
public deathCount: number,
|
||||
colorIndex: number,
|
||||
team: CharacterTeam,
|
||||
health: number,
|
||||
head?: Circle,
|
||||
leftFoot?: Circle,
|
||||
rightFoot?: Circle,
|
||||
) {
|
||||
super(id, colorIndex, team, health, head, leftFoot, rightFoot);
|
||||
super(id, team, health, head, leftFoot, rightFoot);
|
||||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
|
|
@ -27,7 +26,6 @@ export class PlayerCharacterBase extends CharacterBase {
|
|||
this.name,
|
||||
this.killCount,
|
||||
this.deathCount,
|
||||
this.colorIndex,
|
||||
this.team,
|
||||
this.health,
|
||||
this.head,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { vec2 } from 'gl-matrix';
|
|||
import { Id } from '../../transport/identity';
|
||||
import { serializable } from '../../transport/serialization/serializable';
|
||||
import { GameObject } from '../game-object';
|
||||
import { CharacterTeam } from './character-team';
|
||||
|
||||
@serializable
|
||||
export class ProjectileBase extends GameObject {
|
||||
|
|
@ -9,13 +10,13 @@ export class ProjectileBase extends GameObject {
|
|||
id: Id,
|
||||
public center: vec2,
|
||||
public radius: number,
|
||||
public colorIndex: number,
|
||||
public team: CharacterTeam,
|
||||
public strength: number,
|
||||
) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.id, this.center, this.radius, this.colorIndex, this.strength];
|
||||
return [this.id, this.center, this.radius, this.team, this.strength];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
import { rgb255 } from './helper/rgb255';
|
||||
import { CharacterTeam } from './objects/types/character-team';
|
||||
|
||||
const q = 2.5;
|
||||
const qDim = 1.5;
|
||||
const declaColor = rgb255(64 * q, 105 * q, 165 * q);
|
||||
const neutralColor = rgb255(82 * q, 165 * q, 64 * q);
|
||||
const redColor = rgb255(209 * q, 86 * q, 82 * q);
|
||||
const declaColorDim = rgb255(64 * qDim, 105 * qDim, 165 * qDim);
|
||||
const redColorDim = rgb255(209 * qDim, 8 * qDim, 82 * qDim);
|
||||
const declaPlanetColor = declaColor;
|
||||
const redPlanetColor = redColor;
|
||||
|
||||
|
|
@ -32,14 +37,18 @@ export const settings = {
|
|||
projectileFadeSpeed: 20,
|
||||
projectileCreationInterval: 0.1,
|
||||
playerColorIndexOffset: 3,
|
||||
backgroundGradient: [rgb255(90, 38, 43), rgb255(43, 39, 73)],
|
||||
backgroundGradient: [rgb255(90, 38, 43), rgb255(0, 0, 0), rgb255(43, 39, 73)],
|
||||
declaColor,
|
||||
declaPlanetColor,
|
||||
redColor,
|
||||
redPlanetColor,
|
||||
declaIndex: 0,
|
||||
redIndex: 1,
|
||||
palette: [declaColor, redColor],
|
||||
colorIndices: {
|
||||
[CharacterTeam.decla]: 0,
|
||||
[CharacterTeam.neutral]: 1,
|
||||
[CharacterTeam.red]: 2,
|
||||
},
|
||||
palette: [declaColor, neutralColor, redColor],
|
||||
paletteDim: [declaColorDim, neutralColor, redColorDim],
|
||||
targetPhysicsDeltaTimeInMilliseconds: 20,
|
||||
minPhysicsSleepTime: 4,
|
||||
velocityAttenuation: 0.25,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue