[game] Do some amount of snapshot save and restore
This is super jankety and I feel the need for organization but FOR NOW let's hack away.
This commit is contained in:
parent
e32643486d
commit
043a3ee183
1 changed files with 14 additions and 0 deletions
14
game/main.ts
14
game/main.ts
|
|
@ -49,6 +49,20 @@ export function init() {
|
||||||
load_assets();
|
load_assets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function suspend() {
|
||||||
|
return { clock };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resume(snapshot) {
|
||||||
|
if (snapshot) {
|
||||||
|
print("!Resuming!");
|
||||||
|
const { clock: new_clock } = snapshot;
|
||||||
|
if (new_clock) {
|
||||||
|
clock = new_clock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const friction = 0.6;
|
const friction = 0.6;
|
||||||
let robo_vel = new_v2(0);
|
let robo_vel = new_v2(0);
|
||||||
let robo_pos = new_v2(10);
|
let robo_pos = new_v2(10);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue