Skip to content

Commit 0a40dc8

Browse files
authored
Docs and some randomness removal (#38)
* feat: remove slowmo timer - render only one rock * docs: README * fix: remove zone randomization * docs: mod README
1 parent 3b91b1b commit 0a40dc8

File tree

4 files changed

+51
-16
lines changed

4 files changed

+51
-16
lines changed

README.md

+49-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,57 @@
11
# Comets
22

3-
## Use
3+
![Comets Gameplay](comets.gif)
4+
5+
Comets is a fully-onchain space-themed game rollup inspired by the classic Asteroids.
6+
Navigate through a field of asteroids, blast them into smaller pieces, and watch out for alien ships!
7+
8+
## Controls
9+
10+
- Press `ENTER` button to start the game
11+
- Rotate: Left/Right arrow keys or A and D
12+
- Thrust: Up arrow or W
13+
- Fire: Space bar
14+
- Hyperspace: CTRL
15+
16+
Every step of your gameplay is recorded and verified on-chain so that your score is unspoofable and your legendary run will be remembered forever!
17+
18+
Play it here: https://comets.stf.xyz/
19+
20+
## Development
21+
22+
Comets is composed of two parts:
23+
24+
- a frontend game client
25+
- a micro-rollup web server
26+
27+
To run it locally, you need to first spin up the rollup.
428

529
```shell
6-
# Build Client
7-
npm run build:client
30+
cd game
31+
vim .env
32+
# set up your rollup config
33+
# add PRIVATE_KEY=<your-private-key>
34+
npm i
35+
# start the rollup server
36+
npm start
837
```
938

39+
The server should be running on port 3210 by default.
40+
41+
Now run the Next.js app.
42+
1043
```shell
11-
# Start Server
12-
npm run start:server
44+
cd client
45+
vim game/src/api.ts
46+
# set API_URL=http://localhost:3210
47+
npm install
48+
npm run dev
1349
```
50+
51+
And voila! You're ready to play on your local machine at http://localhost:3000.
52+
53+
## Deployment
54+
55+
To deploy your own version of Comets on Sepolia, make sure to properly setup your config by following this [step](https://docs.stf.xyz/build/zero-to-one/build-your-first-mru#setting-up-your-config).
56+
57+
Then, follow the remaining guide to deploy your very own Comets rollup.

comets.gif

380 KB
Loading

game/src/core/rocks.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ export class Rock extends Object2D {
186186

187187
export function createRocks(level: number): Rock[] {
188188
const rocks = [];
189-
const count = Math.min(level + 1, 12);
189+
const count = 1;
190190
const speed = 150;
191191
const offset = 20;
192192

193193
for (let i = 0; i < count; i++) {
194-
const zone = random(1, Math.pow(42, i)) % 4;
194+
const zone = random(1, 4);
195195
const v = Vector.fromAngle(random(1, 360));
196196
let x: number;
197197
let y: number;

game/src/core/world.ts

-9
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ export class World {
7373
}
7474

7575
update(dt: number, inputs: VirtualInput) {
76-
if (this.slowMoTimer) {
77-
dt = this.slowMoTimer.adjust(dt);
78-
}
79-
8076
if (this.dramaticPauseTimer > 0) {
8177
this.dramaticPauseTimer--;
8278
return;
@@ -97,10 +93,6 @@ export class World {
9793
}
9894

9995
render(screen: Screen, dt: number) {
100-
if (this.slowMoTimer) {
101-
dt = this.slowMoTimer.adjust(dt);
102-
}
103-
10496
if (this.shakeTimer > 0) {
10597
screen.preShake();
10698
}
@@ -239,7 +231,6 @@ export class World {
239231
this.createExplosion(this.ship);
240232
this.addFlash(5);
241233
this.ship.destroy();
242-
this.setSlowMo(0.25, 8);
243234
}
244235
}
245236

0 commit comments

Comments
 (0)