updated debug function
This commit is contained in:
parent
9aed8171d0
commit
0493aa0c98
@ -53,7 +53,7 @@ io.on('connection', (socket)=>{
|
|||||||
|
|
||||||
socket.on('username',(username)=>{
|
socket.on('username',(username)=>{
|
||||||
bPlayers[socket.id].username = username
|
bPlayers[socket.id].username = username
|
||||||
console.log("updated username for: "+bPlayers[socket.id])
|
console.log("updated username for: "+bPlayers[socket.id].username)
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('message',(message)=>{
|
socket.on('message',(message)=>{
|
||||||
|
@ -44,22 +44,26 @@ class Player extends Sprite {
|
|||||||
ctx.fillText("Click X&Y :"+[this.clickX,this.clickY], this.position.x, this.position.y-110);
|
ctx.fillText("Click X&Y :"+[this.clickX,this.clickY], this.position.x, this.position.y-110);
|
||||||
ctx.fillText("Position: "+[Math.round(this.position.x),Math.round(this.position.y)], this.position.x, this.position.y-98);
|
ctx.fillText("Position: "+[Math.round(this.position.x),Math.round(this.position.y)], this.position.x, this.position.y-98);
|
||||||
ctx.fillText("Inc X&Y :"+[this.incrementX.toFixed(2),this.incrementY.toFixed(2)], this.position.x, this.position.y-85);
|
ctx.fillText("Inc X&Y :"+[this.incrementX.toFixed(2),this.incrementY.toFixed(2)], this.position.x, this.position.y-85);
|
||||||
ctx.font = 'bold 18px sans-serif';
|
|
||||||
ctx.fillStyle = 'white';
|
|
||||||
ctx.fillText(this.message, this.position.x, this.position.y-65);
|
|
||||||
ctx.font = 'Normal 16px sans-serif';
|
ctx.font = 'Normal 16px sans-serif';
|
||||||
ctx.textAlign = "center";
|
ctx.textAlign = "center";
|
||||||
ctx.fillStyle = 'orange';
|
ctx.fillStyle = 'orange';
|
||||||
ctx.fillText("user ID: " + this.userId, this.position.x, this.position.y+35);
|
ctx.fillText("user ID: " + this.userId, this.position.x, this.position.y+35);
|
||||||
ctx.fillStyle = 'cyan';
|
|
||||||
ctx.fillText(this.username, this.position.x, this.position.y+15);
|
|
||||||
|
|
||||||
ctx.fill()
|
ctx.fill()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
update(){
|
update(){
|
||||||
|
ctx.textAlign = "center";
|
||||||
|
ctx.font = 'bold 18px win98';
|
||||||
|
ctx.fillStyle = 'cyan';
|
||||||
|
ctx.fillText(this.username, this.position.x, this.position.y+15);
|
||||||
|
ctx.font = 'normal 15px sans-serif';
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
|
ctx.fillText(this.message, this.position.x, this.position.y-65);
|
||||||
|
|
||||||
|
ctx.fill()
|
||||||
|
|
||||||
|
|
||||||
// if((Math.sign(incrementX)==1&&fPlayer.x<clickCoordinates[0])||(Math.sign(incrementX)==-1&&fPlayer.x>clickCoordinates[0])){fPlayer.x += incrementX;fPlayer.atPosition=false; socket.emit('clickPositionX',fPlayer.x)}else{fPlayer.atPosition=true}
|
// if((Math.sign(incrementX)==1&&fPlayer.x<clickCoordinates[0])||(Math.sign(incrementX)==-1&&fPlayer.x>clickCoordinates[0])){fPlayer.x += incrementX;fPlayer.atPosition=false; socket.emit('clickPositionX',fPlayer.x)}else{fPlayer.atPosition=true}
|
||||||
|
Loading…
Reference in New Issue
Block a user