create-bloop 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as cfg from "../config";
|
|
2
|
+
import type { game, Player } from "../game";
|
|
2
3
|
import { PhaseSystem } from "./phase";
|
|
3
4
|
|
|
4
5
|
export const CollisionSystem = PhaseSystem("playing", {
|
|
@@ -27,15 +28,24 @@ export const CollisionSystem = PhaseSystem("playing", {
|
|
|
27
28
|
|
|
28
29
|
if (hitX && hitY && bag.coin.visible === false) {
|
|
29
30
|
// Bonk! Stop upward movement
|
|
30
|
-
p
|
|
31
|
-
p.y = blockBottom - cfg.PLAYER_HEIGHT;
|
|
32
|
-
|
|
33
|
-
p.score += 1;
|
|
34
|
-
|
|
35
|
-
bag.coin.hitTime = time.time;
|
|
36
|
-
bag.coin.visible = true;
|
|
37
|
-
bag.coin.winner = p === bag.p1 ? 1 : 2;
|
|
31
|
+
triggerCoin(bag, p, time, blockBottom);
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
34
|
},
|
|
41
35
|
});
|
|
36
|
+
|
|
37
|
+
function triggerCoin(
|
|
38
|
+
bag: typeof game.bag,
|
|
39
|
+
p: Player,
|
|
40
|
+
time: typeof game.context.time,
|
|
41
|
+
blockBottom: number,
|
|
42
|
+
) {
|
|
43
|
+
p.vy = 0;
|
|
44
|
+
p.y = blockBottom - cfg.PLAYER_HEIGHT;
|
|
45
|
+
|
|
46
|
+
p.score += 1;
|
|
47
|
+
|
|
48
|
+
bag.coin.hitTime = time.time;
|
|
49
|
+
bag.coin.visible = true;
|
|
50
|
+
bag.coin.winner = p === bag.p1 ? 1 : 2;
|
|
51
|
+
}
|