Intro cinematic + attract video + filing scene (s00/s04), scenes v3, looping attract player

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
m3ultra 2026-07-20 01:58:44 +10:00
parent 9ab4b2e285
commit 23086be3b7
2 changed files with 34 additions and 3 deletions

View File

@ -29,6 +29,7 @@ async function boot() {
if (G.debug) { initDebug(); window.RSG = { G, input, vid }; }
preload(G.data.scenes[G.data.start].clip);
preload(G.data.scenes[G.data.start].death);
attractPlay();
addEventListener("keydown", onKey);
initTouch();
requestAnimationFrame(tick);
@ -64,10 +65,17 @@ function playClip(url, onEnded) {
const vid = () => vids[cur];
// ---------- scene flow ----------
function attractPlay() { // looping mood video behind the title screen
const v = playClip("clips/attract.mp4", null);
v.loop = true;
v.muted = true;
}
function startGame() {
G.lives = G.data.meta.lives;
G.score = 0;
G.checkpoint = G.data.start;
vids.forEach((v) => { v.muted = false; v.loop = false; });
$("attract").classList.add("hidden");
playScene(G.data.start);
}
@ -134,7 +142,7 @@ function toAttract() {
$("msg").classList.add("hidden");
$("hiscore").textContent = "HI-SCORE " + (localStorage.rsg_hiscore || 0);
$("attract").classList.remove("hidden");
vid().pause();
attractPlay();
G.state = "ATTRACT";
}
function saveHi() {

View File

@ -2,9 +2,9 @@
"meta": {
"title": "RECORD STORE GUY",
"lives": 5,
"version": 2
"version": 3
},
"start": "s01",
"start": "s00",
"scenes": {
"s01": {
"clip": "clips/s01_action.mp4",
@ -59,6 +59,29 @@
"cue": true
}
],
"onSuccess": "s04",
"checkpoint": false
},
"s00": {
"clip": "clips/intro.mp4",
"death": "clips/s01_death.mp4",
"windows": [],
"onSuccess": "s01",
"checkpoint": false
},
"s04": {
"clip": "clips/s04_action.mp4",
"death": "clips/s04_death.mp4",
"windows": [
{
"t": [
6.0,
7.2
],
"input": "left",
"cue": true
}
],
"onSuccess": "WIN",
"checkpoint": false
}