소스 검색

"fixed" race condition, faster shooting

master
mort 8 년 전
부모
커밋
f21b42068c
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5
    3
      js/game.js

+ 5
- 3
js/game.js 파일 보기

@@ -146,7 +146,9 @@ class Player extends Entity {
id: this.id
});

game.entities.forEach((e) => e.send(true));
setTimeout(() => {
game.entities.forEach((e) => e.send(true));
}, 100);
} else if (req.url == "keydown") {
this.keys[req.data.key] = true;
} else if (req.url == "keyup") {
@@ -194,7 +196,7 @@ class Player extends Entity {
let b = new Bullet(pos, vel, this.id, this.game.id, this.game);
this.game.spawn(b);
this.canShoot = false;
setTimeout(() => this.canShoot = true, 300);
setTimeout(() => this.canShoot = true, 100);
}

f.rotate(this.rot);
@@ -296,7 +298,7 @@ export default class Game {
this.prevTime = null;

this.updateInterval = 1000/30;
this.sendInterval = 1000/15;
this.sendInterval = 1000/20;
this.dt = 0;

this.id = 1;

Loading…
취소
저장