fix projectiles
This commit is contained in:
parent
0906441246
commit
4f42723f4a
7 changed files with 20 additions and 8 deletions
|
@ -11,8 +11,8 @@ class Body {
|
|||
this.fixtures = data.fixtures;
|
||||
this.b2body = false;
|
||||
this.updated = 0;
|
||||
|
||||
game.world.update(data.delta);
|
||||
|
||||
this.update(data.delta.slice(1));
|
||||
|
||||
this.com = {
|
||||
x: 0,
|
||||
|
|
|
@ -44,10 +44,9 @@ class World {
|
|||
};
|
||||
|
||||
update(data) {
|
||||
let array = new Float32Array(data);
|
||||
let i = 0;
|
||||
while (i < array.length) {
|
||||
let id = array[i++];
|
||||
while (i < data.length) {
|
||||
let id = data[i++];
|
||||
let body = this.bodies[id];
|
||||
|
||||
if (!body) {
|
||||
|
@ -55,7 +54,7 @@ class World {
|
|||
return;
|
||||
}
|
||||
|
||||
body.update(array.slice(i, i + body.interface.size));
|
||||
body.update(data.slice(i, i + body.interface.size));
|
||||
i += body.interface.size;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue