improve multiplayer
This commit is contained in:
parent
0aa259b874
commit
2fffe574c1
10 changed files with 76 additions and 19 deletions
|
@ -1,8 +1,8 @@
|
|||
function Asteroid(data) {
|
||||
this.id = data.id;
|
||||
this.x = data.delta[0];
|
||||
this.y = data.delta[1];
|
||||
this.r = data.delta[2];
|
||||
this.x = data[0];
|
||||
this.y = data[1];
|
||||
this.r = data[2];
|
||||
this.bodyType = 'asteroid';
|
||||
this.frame = data.frame;
|
||||
|
||||
|
@ -16,6 +16,17 @@ function Asteroid(data) {
|
|||
this.update = function(data) {
|
||||
this.x = data[0];
|
||||
this.y = data[1];
|
||||
this.xvel = data[2];
|
||||
this.yvel = data[3];
|
||||
this.r = data[4];
|
||||
this.rvel = data[5];
|
||||
}
|
||||
|
||||
this.tick = function() {
|
||||
this.x += this.xvel * 10;
|
||||
this.y += this.yvel * 10;
|
||||
this.r += this.rvel * 10;
|
||||
this.xvel *= 0.98;
|
||||
this.yvel *= 0.98;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue