-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbobs.js
56 lines (51 loc) · 1.25 KB
/
bobs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// prettier-ignore
// ball sprite as 2x2 tiles
const ball = [
0x00, 0x00, 0x03, 0x33,
0x00, 0x03, 0x32, 0x22,
0x00, 0x32, 0x22, 0x22,
0x03, 0x22, 0x11, 0x22,
0x03, 0x21, 0x11, 0x12,
0x32, 0x21, 0x11, 0x12,
0x32, 0x22, 0x11, 0x22,
0x32, 0x22, 0x22, 0x22,
0x44, 0x50, 0x00, 0x00,
0x22, 0x33, 0x50, 0x00,
0x12, 0x23, 0x35, 0x00,
0x22, 0x23, 0x34, 0x50,
0x22, 0x22, 0x33, 0x50,
0x22, 0x22, 0x33, 0x45,
0x22, 0x22, 0x33, 0x45,
0x22, 0x23, 0x33, 0x45,
0x42, 0x22, 0x22, 0x22,
0x42, 0x22, 0x22, 0x22,
0x43, 0x22, 0x22, 0x22,
0x04, 0x33, 0x22, 0x23,
0x05, 0x33, 0x33, 0x33,
0x00, 0x54, 0x33, 0x33,
0x00, 0x05, 0x54, 0x44,
0x00, 0x00, 0x05, 0x55,
0x22, 0x23, 0x33, 0x45,
0x22, 0x33, 0x34, 0x45,
0x23, 0x33, 0x34, 0x45,
0x33, 0x33, 0x44, 0x50,
0x33, 0x34, 0x44, 0x50,
0x34, 0x44, 0x45, 0x00,
0x44, 0x45, 0x50, 0x00,
0x55, 0x50, 0x00, 0x00,
]
function BOOT() {
memset(SPRITE_BASE + 20 * 32, ball);
memset32(PALETTE + 4, [0xfe2ffe, 0x9900cc, 0x590098, 0x2c0068, 0x010230]);
}
function TICK() {
cls();
let t = peek32(FRAME) * 0.01;
for (let i = 1; i < 100; i++) {
let tt = t + i * 0.05;
let x = (140 * sin(3 * tt + 0.8) + W2 - 8) | 0;
let y = (70 * sin(4 * tt) + H2 - 8) | 0;
tiles([20, 21], x, y, 0);
tiles([22, 23], x, y + 8, 0);
}
}