2 parents 85843ba + 9ace2b8 commit 16d9166Copy full SHA for 16d9166
1 file changed
packages/web/src/component/game.ts
@@ -289,8 +289,14 @@ class World {
289
// 壁との当たり判定
290
for (const fighter of this.fighters) {
291
fighter.location = {
292
- x: Math.min(fighter.location.x, STAGE_WIDTH - fighter.size.x),
293
- y: Math.min(fighter.location.y, STAGE_HEIGHT - fighter.size.y),
+ x: Math.min(
+ Math.max(fighter.location.x, 0),
294
+ STAGE_WIDTH - fighter.size.x
295
+ ),
296
+ y: Math.min(
297
+ Math.max(fighter.location.y, 0),
298
+ STAGE_HEIGHT - fighter.size.y
299
300
};
301
}
302
0 commit comments