Compare commits
No commits in common. "02f3c87804288c0ceea613a5ae47f206e2b94f0f" and "dfd649ba65640e5ff5e533a4f9e8351ac2fbee8e" have entirely different histories.
02f3c87804
...
dfd649ba65
3 changed files with 1 additions and 13 deletions
|
|
@ -4,7 +4,7 @@ const playerSize = 50.;
|
||||||
const playerSpeed=.2;
|
const playerSpeed=.2;
|
||||||
const bulletSpeed=playerSpeed*2;
|
const bulletSpeed=playerSpeed*2;
|
||||||
const halfSqrtTwo=0.70710678118;
|
const halfSqrtTwo=0.70710678118;
|
||||||
const defaulthealth=10.;
|
const defaulthealth=10
|
||||||
|
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,6 @@ function game() {
|
||||||
player=Net.clientPlayer;
|
player=Net.clientPlayer;
|
||||||
players=Net.getPlayersToAdd();
|
players=Net.getPlayersToAdd();
|
||||||
Renderer.AddPlayer(player)
|
Renderer.AddPlayer(player)
|
||||||
Renderer.SetPlayerId(player.id)
|
|
||||||
|
|
||||||
console.log("Connected as id ",playerId);
|
console.log("Connected as id ",playerId);
|
||||||
Inp.player=player;
|
Inp.player=player;
|
||||||
|
|
|
||||||
11
js/render.js
11
js/render.js
|
|
@ -11,11 +11,6 @@ class Render {
|
||||||
this.bullets = [];
|
this.bullets = [];
|
||||||
this.mapsrc=mapsrc;
|
this.mapsrc=mapsrc;
|
||||||
this.ReloadAff();
|
this.ReloadAff();
|
||||||
this.playerid=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetPlayerId(id) {
|
|
||||||
this.playerid=id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPlayer(player) {
|
AddPlayer(player) {
|
||||||
|
|
@ -54,12 +49,6 @@ class Render {
|
||||||
this.ctx.fillStyle = 'white';
|
this.ctx.fillStyle = 'white';
|
||||||
this.ctx.font="10pt arial";
|
this.ctx.font="10pt arial";
|
||||||
this.ctx.fillText(player.name,player.x-player.name.length*10/3,player.y-playerSize/1.8);
|
this.ctx.fillText(player.name,player.x-player.name.length*10/3,player.y-playerSize/1.8);
|
||||||
if(player.id==this.playerid) {
|
|
||||||
this.ctx.fillStyle = 'red';
|
|
||||||
this.ctx.fillRect(player.x-playerSize/2-5, player.y-playerSize/2, playerSize+10, 5);
|
|
||||||
this.ctx.fillStyle = '#7AFF33';
|
|
||||||
this.ctx.fillRect(player.x-playerSize/2-5, player.y-playerSize/2, player.health*(playerSize+10)/defaulthealth, 5);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderBullet(bullet) {
|
RenderBullet(bullet) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue