diff --git a/base64/move.png.64 b/base64/move.png.64 new file mode 100644 index 0000000..8564eb0 --- /dev/null +++ b/base64/move.png.64 @@ -0,0 +1 @@ +iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADpAAAA6QFUkhRLAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAA9VJREFUWIXtV1toXEUY/mbOye7Mf/berMZIGkxtSsWKNY0ltSWKl4iYh7ZQCgGLFCmSFxGkDxGkYgUrCBW1qNQnQbF46Wq0FiKBgLWNISnEXgJqTDSxqdk0u+nZs3vO7PiSxO2aPOxum6d8MC//zHeZ4fxzGAMVgIg6OeezSqnpSnTKgpRyLRGliej0ipsDABEliEgTkZZS7l1Rcynl3gXz+TEZiUQi5WgZpRKi0WhYKZUAECwoB5RSluu635Wqx0slZLPZ3QAumLHwoBkLa9q0/hpj7ARjLB4KhWKl6pWNlksnn6zd+Zh776dvDFaiU/IJ3GysBig7QN7zGsAYZ4yvqSQAK5Vwf++Hj3MhG5G63uWM/nWHWR3NG5HAYUNKv64PHxqobbcrDWAIIbY5jtNXPNHUe/yR7N/TX+VGJwIz3X0cngIA8GhQxzuegq+2eogF81sHthxwi7lEtNm27f91DC9a9AARneGcv7RUWm6J9c7IaGC25xz3rs5A3nMXuCXh/jnFJt/+hKlM7u5gU6NeZrOHLcvqDQaDGwqLJgBEIpGI67qHtNadAAwekD3NQ581FC7MX7c3upNTXalTP3GVmkP9my9AOVnwKhPOpT+Q7O7D7Ld9Pn9N9TvNI98cKXa/uG2fzNuZVqXUIBEdsW37dQA507Ksjlwu9xaA2xZTxSI7pt8/cfYGBcOwRGOd1DqPcFsLwAAzHAQYULW2Bmr6GuxffvOnfx5+Lnt5bHdxAHNNOJSzMwAgAbxCRDu11gdMrfUFAGOFAQzhc8WG+plCAWYYnAu/AMDy2SyQB/JpG3nPgxmywEgCWsMXj2kGdgMXAIwf+iUAX0GphnO+buEjNKWUnYyx1wAEAHTbtv10scjmU+99Pv7ysV1520HtwWfApB8GSSS/6IHz+wTCDzcno3sebTm3cddIMZeIEgDaAWit9cemab6YTqf/MefnvUwmc1QIkeCcH8My7WmEAnPx/e366vEEm/roJJTtQOc8mLEQdM5FoGUTkYiOLcWdx3mt9fOZTObM4skutWq5lmm6/HW1Hp/oV7Nzt1/54EvhzaSYVh7CrVvmwm0tVVyIgwOtzx5dSlMIscNxnB8BqMJ6yRfRfee/t6pcbnL3yul0//CDouFO5a+Lb/cC/OLAuj2zpeqVjdXf8WqAm4WSu4CI9jPG2qpq4jXac7cbocCc8+v4WQCOEKIjmUymbkHO/yClrJt/Eemi0VWOXsnvAs/zUj6fzwXwREF52LbtfSi6ZG4lTCIamt+5klI+tFLGi5BSbiUiRUTvrrj5Aojo1Wg0Gq5E41+gImj+YjLC1wAAAABJRU5ErkJggg== \ No newline at end of file diff --git a/dot.svg b/dot.svg index 6d1485c..f82df78 100644 --- a/dot.svg +++ b/dot.svg @@ -8,37 +8,37 @@ 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" - width="210mm" - height="297mm" - viewBox="0 0 210 297" - version="1.1" - id="svg8" - inkscape:export-filename="C:\Users\sigon\OneDrive\Documents\ProjectM\ProjectM\pause.png" - inkscape:export-xdpi="5.0500002" - inkscape:export-ydpi="5.0500002" + inkscape:version="1.0 (4035a4fb49, 2020-05-01)" sodipodi:docname="dot.svg" - inkscape:version="1.0 (4035a4fb49, 2020-05-01)"> + inkscape:export-ydpi="5.0500002" + inkscape:export-xdpi="5.0500002" + inkscape:export-filename="C:\Users\sigon\OneDrive\Documents\ProjectM\ProjectM\pause.png" + id="svg8" + version="1.1" + viewBox="0 0 210 297" + height="297mm" + width="210mm"> + inkscape:window-x="1980" + inkscape:window-height="1074" + inkscape:window-width="1274" + showgrid="false" + inkscape:document-rotation="0" + inkscape:current-layer="layer13" + inkscape:document-units="mm" + inkscape:cy="725.39498" + inkscape:cx="421.60463" + inkscape:zoom="0.70710678" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" /> @@ -52,183 +52,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="layer2" + inkscape:groupmode="layer"> - - + + transform="rotate(90)" + style="fill:#206476;fill-opacity:1;fill-rule:evenodd;stroke:#bcbcbc;stroke-width:0.964999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect1010-9" + width="44.901279" + height="198.84853" + x="128.82391" + y="-205.79753" + ry="0" /> + + style="display:inline;fill:#206476;fill-opacity:1;stroke:#878787;stroke-width:0.26766px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:export-xdpi="4.0677924" + inkscape:export-ydpi="4.0677924" /> diff --git a/game.js b/game.js index 0c58c36..8a29f1d 100644 --- a/game.js +++ b/game.js @@ -128,6 +128,9 @@ var LAST_MOUSE_Y=0; var DRAG_X = -1 var DRAG_Y = -1 var BOT_DID_NOT_REACH_EXIT = false +var TOOLTIPDISPLAYED = undefined +var MOVEMODE = false +var STARTDRAG = undefined var MESSAGETIMER = -1 var EXPECTED = true //True means the bot was supposed to accepted, false means the bot was supposed to be rejected. @@ -218,12 +221,18 @@ var DELETE_BUTTON = {img:ID_DELETE,x:-1,y:-1,w:-1,h:-1,cb:toggleDeleteMode,toolt } var HOME_BUTTON = {img:ID_HOME,x:-1,y:-1,w:-1,h:-1,cb:goHome,tooltip:"Go back to the level selection menu." } +var MOVE_BUTTON = {img:ID_MOVE_BUTTON,x:2,y:2,w:32,h:32,cb:toggleMoveMode,tooltip:"Scroll the view area." +} var MENU = { 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 toggleMoveMode() { + setMoveMode(!MOVEMODE) +} + function saveLevelData() { completedStages[gameStage.name].data=deepCopy(gameGrid) localStorage.setItem("game",JSON.stringify(completedStages)) @@ -233,12 +242,16 @@ function goHome() { saveLevelData() MENU.visible=false BRIDGEDBELT=false + setMoveMode(false) + GRID_X=20 + GRID_Y=20 ITEM_SELECTED=undefined for (var button of MENU.buttons) { if (button.submenu_buttons) { button.lastselected=button.default } } + gameGrid=[] gameState=MAINMENU } @@ -406,6 +419,27 @@ var STAGE2 = { return true; } } +var STAGE3 = { + name:"Balance", + objective:"Accept bots with the same number of red and blue.", + level:createGrid(15,15,14,7), + start:{x:0,y:7}, + accept:(tape)=>{ + var reds=0; + var blues=0; + for (var i=0;i=500) { + if (MOBILE&&new Date().getTime()-MOUSEOVERTIME>=4000 || !MOBILE&&new Date().getTime()-MOUSEOVERTIME>=1000) { mouseOverButton = button } } @@ -1932,9 +2019,17 @@ function RenderMenu(ctx) { if (!mousedOver) { MOUSEOVERTIME=-1 } + + if (gridModeIsAvailable()) { + AddButton(MOVE_BUTTON.img,MOVE_BUTTON.x,MOVE_BUTTON.y,ctx,MOVE_BUTTON,MOVE_BUTTON.cb) + } } } +function gridModeIsAvailable() { + return (gameGrid.length>5||(gameGrid.length>0&&gameGrid[0].length>5))&&!DELETEMODE +} + function AddButton(img,x,y,ctx,button,dir=0) { ctx.fillStyle="#b5b5b5" ctx.fillRect(x,y,32,32) diff --git a/image_data.js b/image_data.js index 468775f..a24fa59 100644 --- a/image_data.js +++ b/image_data.js @@ -41,6 +41,7 @@ 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") const [IMAGE_CHECKMARK,ID_CHECKMARK] = addIm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xffvOnfx5+Lnt5bHdxAHNNOJSzMwAgAbxCRDu11gdMrfUFAGOFAQzhc8WG+plCAWYYnAu/AMDy2SyQB/JpG3nPgxmywEgCWsMXj2kGdgMXAIwf+iUAX0GphnO+buEjNKWUnYyx1wAEAHTbtv10scjmU+99Pv7ysV1520HtwWfApB8GSSS/6IHz+wTCDzcno3sebTm3cddIMZeIEgDaAWit9cemab6YTqf/MefnvUwmc1QIkeCcH8My7WmEAnPx/e366vEEm/roJJTtQOc8mLEQdM5FoGUTkYiOLcWdx3mt9fOZTObM4skutWq5lmm6/HW1Hp/oV7Nzt1/54EvhzaSYVh7CrVvmwm0tVVyIgwOtzx5dSlMIscNxnB8BqMJ6yRfRfee/t6pcbnL3yul0//CDouFO5a+Lb/cC/OLAuj2zpeqVjdXf8WqAm4WSu4CI9jPG2qpq4jXac7cbocCc8+v4WQCOEKIjmUymbkHO/yClrJt/Eemi0VWOXsnvAs/zUj6fzwXwREF52LbtfSi6ZG4lTCIamt+5klI+tFLGi5BSbiUiRUTvrrj5Aojo1Wg0Gq5E41+gImj+YjLC1wAAAABJRU5ErkJggg==") function addImage(base64){ var newImage = new Image() diff --git a/move.png b/move.png new file mode 100644 index 0000000..a92b267 Binary files /dev/null and b/move.png differ