Skip to content

Commit d65e8fa

Browse files
fix: decrease area hitbox of keys
1 parent 96c356b commit d65e8fa

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/gameobjects/keys.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Key as KaboomKey } from 'kaboom';
22

33
import { DirectionKey, Key, Sound, Tag } from '../constants';
4-
import { getPosition, isDirectionKeyPressed } from '../helpers';
4+
import { getArea, getPosition, isDirectionKeyPressed } from '../helpers';
55
import { incrementScore } from './score';
66
import { addStar } from './star';
77

@@ -73,7 +73,7 @@ function addKeyObject(key: DirectionKey) {
7373
sprite(Key[key]),
7474
getPosition(key),
7575
anchor('center'),
76-
area(),
76+
getArea(),
7777
opacity(0.5),
7878
Tag[key],
7979
]);

src/helpers/area.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function getArea() {
2+
return area({
3+
scale: 0.5,
4+
});
5+
}

src/helpers/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './area';
12
export * from './hitAccuracy';
23
export * from './keys';
34
export * from './position';

src/scenes/game.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Tag,
88
} from '../constants';
99
import { addKeys, addPause, addScore, addTimer } from '../gameobjects';
10-
import { getPosition } from '../helpers';
10+
import { getArea, getPosition } from '../helpers';
1111
import { volumeSlider } from '../helpers/volumeSlider';
1212
import { levels } from '../levels';
1313

@@ -53,19 +53,17 @@ scene(Scene.game, (levelId: string) => {
5353
area(),
5454
anchor('bot'),
5555
offscreen({ destroy: true }),
56-
'note',
5756
]);
5857
}
5958

6059
game.add([
6160
sprite(Direction[direction as DirectionKey]),
6261
getPosition(direction as DirectionKey, -60),
6362
move(DOWN, 250),
64-
area(),
63+
getArea(),
6564
anchor('center'),
6665
offscreen({ destroy: true }),
6766
Tag.direction,
68-
'note',
6967
]);
7068
});
7169
});

0 commit comments

Comments
 (0)