diff --git a/Shostakovich_ Symphony No. 9.mp3 b/Shostakovich_ Symphony No. 9.mp3 new file mode 100644 index 0000000..7cbcf78 Binary files /dev/null and b/Shostakovich_ Symphony No. 9.mp3 differ diff --git a/SigsWorks.png b/SigsWorks.png new file mode 100644 index 0000000..46da23c Binary files /dev/null and b/SigsWorks.png differ diff --git a/SigsWorks.svg b/SigsWorks.svg new file mode 100644 index 0000000..1b1e349 --- /dev/null +++ b/SigsWorks.svg @@ -0,0 +1,597 @@ + + + + + + + + image/svg+xml + + + + + + + + + Sig's Works Presents... + + + + + + + + + + + + + diff --git a/Super 8 Old Movie Projector - Gaming Sound Effect.mp3 b/Super 8 Old Movie Projector - Gaming Sound Effect.mp3 new file mode 100644 index 0000000..8d59207 Binary files /dev/null and b/Super 8 Old Movie Projector - Gaming Sound Effect.mp3 differ diff --git a/THE GREAT CONVERSION.png b/THE GREAT CONVERSION.png new file mode 100644 index 0000000..e0e96f0 Binary files /dev/null and b/THE GREAT CONVERSION.png differ diff --git a/THE GREAT CONVERSION_color.png b/THE GREAT CONVERSION_color.png new file mode 100644 index 0000000..6e0b568 Binary files /dev/null and b/THE GREAT CONVERSION_color.png differ diff --git a/THE GREAT CONVERSION_old.png b/THE GREAT CONVERSION_old.png new file mode 100644 index 0000000..13d4354 Binary files /dev/null and b/THE GREAT CONVERSION_old.png differ diff --git a/dot.svg b/dot.svg index 5e82590..dd5112a 100644 --- a/dot.svg +++ b/dot.svg @@ -5,6 +5,7 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="1.0 (4035a4fb49, 2020-05-01)" @@ -21,17 +22,17 @@ id="defs2" /> + + + + Sig's Works Presents... + + + { + SCENE_DRAW=(ctx)=>{ + ctx.globalAlpha=Math.min((new Date().getTime()-TITLESCREENTIMELINE)/3000,1) + ctx.drawImage(IMAGE_SIG,canvas.width/2-243,canvas.height/2-22) + } + } + }, + {time:4000,cb: + (ctx)=>{ + SCENE_DRAW=(ctx)=>{ + ctx.globalAlpha=Math.max( + (7000-(new Date().getTime()-TITLESCREENTIMELINE))/3000 + ,0) + ctx.drawImage(IMAGE_SIG,canvas.width/2-243,canvas.height/2-22) + } + } + }, + {time:6500,cb: + (ctx)=>{ + var audio = new Audio("Super 8 Old Movie Projector - Gaming Sound Effect.mp3") + audio.play() + } + }, + {time:7000,cb: + (ctx)=>{ + SCENE_DRAW=(ctx)=>{ + SCENEALPHA=0 + if (Math.random()<=0.02) { + ctx.globalAlpha=0.5 + ctx.drawImage(IMAGE_TITLE,canvas.width/2+Math.random()*640260,canvas.height/2+Math.random()*64-70) + } else { + ctx.globalAlpha=0.75+Math.random()*0.25 + ctx.drawImage(IMAGE_TITLE,canvas.width/2-260,canvas.height/2-70) + } + } + } + }, + {time:15000,cb: + (ctx)=>{ + backgroundMusic.loop=true + backgroundMusic.play() + SCENE_DRAW=(ctx)=>{ + ctx.globalAlpha=0.9 + ctx.drawImage(IMAGE_TITLE,canvas.width/2-260,canvas.height/2-70) + + ctx.font="bold 48px 'Zilla Slab', serif" + ctx.fillStyle="black" + ctx.strokeStyle="white" + ctx.textAlign = "center" + ctx.fillText("- Click to Play -",canvas.width/2,canvas.height*0.9) + ctx.strokeText("- Click to Play -",canvas.width/2,canvas.height*0.9) + } + } + }, + ] + +var backgroundMusic = new Audio("Shostakovich_ Symphony No. 9.mp3") +var SCENEBACKGROUND = "black" +var SCENEALPHA = 1.0 + +var CURRENTTIMELINE = [] +var SCENE_DRAW = ()=>{} + const WAITING = 0; const RUNNING = 1; const REVIEWING = 2; @@ -20,6 +87,8 @@ const TESTING = 3; const FINISH = 4; const PAUSED = 5; const MAINMENU = 6; +const TITLE = 7; +const STARTUP = 8; var ISTESTING = false; @@ -145,10 +214,12 @@ var HOME_BUTTON = {img:ID_HOME,x:-1,y:-1,w:-1,h:-1,cb:goHome } var MENU = { - visible:true, + visible:false, buttons:[CONVEYOR_BUILD_BUTTON,BRANCH_BUILD_BUTTON,WRITER_BUILD_BUTTON,ROTATE_COUNTERCLOCKWISE_BUTTON,ROTATE_CLOCKWISE_BUTTON,DELETE_BUTTON,PLAY_BUTTON,RESET_BUTTON,HOME_BUTTON] } + + function saveLevelData() { completedStages[gameStage.name].data=deepCopy(gameGrid) localStorage.setItem("game",JSON.stringify(completedStages)) @@ -156,6 +227,7 @@ function saveLevelData() { function goHome() { saveLevelData() + MENU.visible=false gameState=MAINMENU } @@ -572,8 +644,15 @@ function setupGame() { completedStages={} } }catch{} - console.log(completedStages) - loadStage(STAGE2) + //console.log(completedStages) + //loadStage(STAGE2) + gameState=MAINMENU +} + +function setupTitleScreen() { + gameState=TITLE + CURRENTTIMELINE=[...TITLETIMELINE] + TITLESCREENTIMELINE=new Date().getTime(); } function CheckKeys(e,keys) { @@ -615,6 +694,16 @@ function clickEvent(e) { } else { MOBILE=false } + + if (gameState===STARTUP) { + setupTitleScreen() + } + if (gameState===TITLE) { + if (new Date().getTime()-TITLESCREENTIMELINE>=15000) { + gameState=MAINMENU + } + } + if (MENU.visible) { for (var button of MENU.buttons) { if (mouseOverButton(canvas,e,button)) { @@ -748,8 +837,10 @@ function deepCopy(arr) { function step() { dashOffset+=0.1*Math.max((1000/gameSpeed),1) - if (gameState===RUNNING) { - runBot() + switch (gameState) { + case RUNNING:{ + runBot() + }break; } } @@ -864,10 +955,21 @@ function drawImage(x,y,img,ctx,degrees,scale=1){ ctx.translate(x,y); ctx.rotate(degrees*Math.PI/180); ctx.scale(scale,scale) - ctx.drawImage(IMAGE_DATA[img],-IMAGE_DATA[img].width/2,-IMAGE_DATA[img].height/2); + ctx.drawImage(IMAGE_DATA[img],(IMAGE_DATA[img].width)?-IMAGE_DATA[img].width/2:0,(IMAGE_DATA[img].height)?-IMAGE_DATA[img].height/2:0); ctx.restore(); } +function runEvents(ctx) { + var elapsedTime= new Date().getTime()-TITLESCREENTIMELINE + if (CURRENTTIMELINE.length>0) { + var currentEvent = CURRENTTIMELINE[0] + if (currentEvent.time + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/image_data.js b/image_data.js index 03f934d..c6b5245 100644 --- a/image_data.js +++ b/image_data.js @@ -36,9 +36,18 @@ const [IMAGE_EXIT,ID_EXIT] = addImage("iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABze const [IMAGE_COMPLETE_STAR,ID_COMPLETE_STAR] = addImage("iVBORw0KGgoAAAANSUhEUgAAACAAAAAfCAYAAACGVs+MAAAACXBIWXMAAAEvAAABLwGpNvipAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAtpJREFUSIm9lk9IFHEUxz/urtVWq2KIaeDBEjQNDEGQQtjMctVEo0sK2S0oiv5QBEHWzWMHIwrKtKPapYSkiLp16xIdUqNk2YqWoFJX0+11mJn1NzOrzszGPngwv5nf+36/897v/X4/8G5hIA68AUIZ4Hi2l4Dofirb5CFgUREwnm0BXQq5AAt4LIPPo4CIZbwROOQRy5N9xpwBAYayRV5jkObkmATEgYBbMC8laDUeWiJQVJR6vw3Ylw0Bqfq3t0Nrm+lbhwc8V2Zqv8lpZOyxqQxTbgGNmpUpzwtAwjJvXiduAjYAVFZCeTkUF0MwCAktYidwEpgDcoGt+vwtaJ2yGdgEBIG/6Av3EfYVva6fv4AkRfO2dvfxusd8QKfbtAFElJ2g0xMCAHE/sIyW2hynUY2NcL0PfPoSrtoN0SgEAlBWBpVVWolqa6F2L8RiqRKp9go4Zgz2A9Mo6cnLQ+4/0FKcWETiP1bcSP16HvuKtERsaf8DXCVNBwaBfiCpBhxuQWaizkkNfzaBlJTYyD8CDetluBmYUQMLCpChYWfEcwnk7DnbLinAMFpXOLIC0nRHdw8yv7A6+eISUl9vI44DR50SW60L+KYCDj5c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NPR8r+ILPFO7yler6OfPP5uVS4au/teuAAAAAElFTkSuQmCC") +const [IMAGE_GEAR,ID_GEAR] = addImageUTF8("gear.svg") +const [IMAGE_SIG,ID_SIG] = addImageUTF8("SigsWorks.svg") +const [IMAGE_TITLE,ID_TITLE] = addImageUTF8("THE GREAT CONVERSION_old.png") +const [IMAGE_COLORTITLE,ID_COLORTITLE] = addImageUTF8("THE GREAT CONVERSION_color.png") function addImage(base64){ var newImage = new Image() newImage.src = "data:image/png;base64,"+base64 return [newImage,IMAGE_DATA.push(newImage)-1] +} +function addImageUTF8(src){ + var newImage = new Image() + newImage.src = src + return [newImage,IMAGE_DATA.push(newImage)-1] } \ No newline at end of file