From ec8a66124a6691c66228f257090997ddfec29930 Mon Sep 17 00:00:00 2001 From: AlexSchirack Date: Mon, 9 Nov 2026 20:23:51 -0500 Subject: [PATCH 1/2] Level 4 and colored buckets. --- .DS_Store | Bin 0 -> 6148 bytes src/.DS_Store | Bin 0 -> 6148 bytes src/assets/.DS_Store | Bin 0 -> 6148 bytes src/assets/conveyer_photos/.DS_Store | Bin 0 -> 6148 bytes src/assets/conveyer_photos/GoalBucket.png | Bin 584 -> 0 bytes src/assets/conveyer_photos/blueBucket.png | Bin 0 -> 163 bytes src/assets/conveyer_photos/blueCircle.png | Bin 0 -> 432 bytes src/assets/conveyer_photos/blueTriangle.png | Bin 0 -> 376 bytes src/assets/conveyer_photos/greenBucket.png | Bin 0 -> 166 bytes src/assets/conveyer_photos/greenCircle.png | Bin 0 -> 434 bytes src/assets/conveyer_photos/greenTriangle.png | Bin 0 -> 722 bytes src/assets/conveyer_photos/redBucket.png | Bin 0 -> 161 bytes src/assets/conveyer_photos/redCircle.png | Bin 0 -> 429 bytes src/assets/conveyer_photos/redTriangle.png | Bin 0 -> 373 bytes src/index.html | 1 + src/js/level1.js | 26 ++-- src/js/level2.js | 43 ++++++- src/js/level3.js | 36 +++++- src/js/level4.js | 118 +++++++++++++++++++ src/js/main.js | 15 ++- 20 files changed, 222 insertions(+), 17 deletions(-) create mode 100644 .DS_Store create mode 100644 src/.DS_Store create mode 100644 src/assets/.DS_Store create mode 100644 src/assets/conveyer_photos/.DS_Store delete mode 100644 src/assets/conveyer_photos/GoalBucket.png create mode 100644 src/assets/conveyer_photos/blueBucket.png create mode 100644 src/assets/conveyer_photos/blueCircle.png create mode 100644 src/assets/conveyer_photos/blueTriangle.png create mode 100644 src/assets/conveyer_photos/greenBucket.png create mode 100644 src/assets/conveyer_photos/greenCircle.png create mode 100644 src/assets/conveyer_photos/greenTriangle.png create mode 100644 src/assets/conveyer_photos/redBucket.png create mode 100644 src/assets/conveyer_photos/redCircle.png create mode 100644 src/assets/conveyer_photos/redTriangle.png create mode 100644 src/js/level4.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8fe22a4fc8c047d70cf46e018da64e42b834c165 GIT binary patch literal 6148 zcmeHKy-ve05dKV4H7X1p8S?-LQ3)i*P|_#pPEp#bAT^}w4p%9;Gpj`8T((&$H9VlVZHTHa@;^ z_J)SuB5E}EHKynxMIVF0>QD=s{ac31;bVUHcDAQEl(KRrtFsDx^!|q(Tp1?lBGJ7$ zMi^k~GOHgQJ`uB(xh}`ads}r4$2Ivm+u!87yz4IqLGg6 zvvo>aBwseFY%&XjmKd z`ICZc0*j%=%pgU`lqn@NrOIA0lqsk2z~+S(GlQla%3eN{U0K;1iqfmo{DDq~3Jppt z3Wx$l1uEvT!RLQ__5HtCBu}D%D6mlqC@<`*ZHc7k_bcF%g-;#iUQvBcce6v9pZs3t>CAmUNtE1!!cBl4jX) ze>g7kY0Fy`e~|%xb|D?o48J4tpI@+g?c4JrO-ETVf<9V*dVMLk9yZ%PlW%>dC$)VN zVg_tLI`#L@^Zkduo_FuDdw07dc_k(;q!aZ(rh6#r7 zm{z>a@D~}7XSa%*dJ-TdldOn|M;^VtzzPZn`?#OrP(|A07dz~IWA1wFp z|H^+dEal?vC8Zta?V0xs17<$JRq5@kWWV>mI-*>|{^{)H;Uv_sVxQc9R`T7E8e9Bp*@ia VF^yO#(n7Hxfk1-|#=u$`_y8arXafKM literal 0 HcmV?d00001 diff --git a/src/assets/conveyer_photos/.DS_Store b/src/assets/conveyer_photos/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cec2c43f24dc14392aa74be4cbbd2d01a67b787d GIT binary patch literal 6148 zcmeH~&rSj{5XPrUjL{3;Jnj>?G4TO5i19)^Nc3c)h$|RT2rT}&?W6mfwrXG@axlh_ z88ZF4({I}Cx7#fh5!aaB9g5UNWE)qk?NBT*ZC9_@MvQEM&i9eayW}#KrVJ}=3z!0? zz<*Of*KS>oS+CFX!rJ{_zpq3NWJK8;6}PSFq!`1!k~W-)6mXv;l}j=QGNqmqObk;pONRM+|3c5GSU!c0iS!2Q*v~alwQVU zYp)Z2ISd`6J2!`G`s))baBW|0o@a5MKWehDzZQ3M&xq@;TXmkxb(`a&+g{~;JLehq zcv|bG+-fuZ)NTbf>iwRvXRB@R2DH)?Fa=D3F9r1bkl>10#4@1&bWr#s09YgJjk=yC zG$)CeMJxl-g1L|ihEx}i7%rp}Pa-diSOyH~;^N`M#gSb+p*TM}{U@F-E(>U-DPRiB zDzF(Y>$?A+EI0X=QH@KSe%78wFB5udNqFeDk a?v1uYD_|C}3`hjCKLTC`D@=huRp0|N_r<6H literal 0 HcmV?d00001 diff --git a/src/assets/conveyer_photos/GoalBucket.png b/src/assets/conveyer_photos/GoalBucket.png deleted file mode 100644 index 39471b6876977b25cab29baef666f7df3e05f2e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 584 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DcoAk4Vx(cMWv4egmB5hW46K32*3xq68y`AMmI6}bgK)eHls47YguJQ{>uF6ifOi{PD zbs{}UK3djZt>nqvW6s4qD1-ZCERRDRmN*N_31y=g{ z<>lpi<;HsXMd|v6mX?v90`zGE;%B09k2gXakl<5wp<;IRwdJb`TMuUx6%m z$bfhmO91 z;G}B?Y4>{XZ)ARCJO64D24_qnaieRD=@+8>dGvw0JrR%LA;KgOZ)<1pIN|K!0ssL2|DB90nE(I)21!Ig aR09A|VZ>2~fVT4h0000%+CAk=IrzbV*83wQlTjz!VNJ!$`gc>t>PrDBRXhPne z8GvLYtr^l|wl-7N%mC%$tZx$liAboKGsBKHD?Jl{3`U(U07*z@0b!P1ZKn&MEzjtw z03;yMh#@;@w02d1*3!&+6996Ocud(vtESNes0~NdssIp^;2&c&&@8p80Oe5R_W=M> z$Y+?Ng?6ra0LYtX+;;#FLOc@yO+3)v0Z=^iy#YW5X#@n?c!|dbARkwp6#ya#BSG-M za|MVr>}fBMK-OEB(Z@@?um1xi`q88_55D1l0HfCX3jhHB|F|sXi2wiq21!IgR09Bu Wqm+TzmPN$?0000d z=#-zFD;Vs4+>QS)3pD-z|NlDAyMYWgkTuKFVdQ&MBb@0NOS* AwEzGB literal 0 HcmV?d00001 diff --git a/src/assets/conveyer_photos/greenCircle.png b/src/assets/conveyer_photos/greenCircle.png new file mode 100644 index 0000000000000000000000000000000000000000..b1d208939ad6d2e2263d6fbfbc235c655fa3aeed GIT binary patch literal 434 zcmV;j0ZsmiP)wXi$S;wL0$xp-KH#IxC1F|+PBeN7Rvu)_v*?Z<)3q&JAG9vG1 zU{7b&0+@SX0kbo(moxBO6yU)G3z;2(J?tG`Hw74&hymce2WUWO>=|#IX#obU0J8w| z3^C{Qy!G;IwE!f9fV)9J26MQh1>D!LSs+B11mbP&3?3((JzM|)0RR8P#ckdI000I_ cL_t&o0IN#Fp%4S=j{pDw07*qoM6N<$g1P3k9smFU literal 0 HcmV?d00001 diff --git a/src/assets/conveyer_photos/greenTriangle.png b/src/assets/conveyer_photos/greenTriangle.png new file mode 100644 index 0000000000000000000000000000000000000000..233ce3e4277ec4e04603f8284b4d4e8de5168ec0 GIT binary patch literal 722 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}0jUw5X}-P; zT0k}j0~4bV12aeo5Hhr9GO&Qz3=C>Ont_3N0V6_o0TWzSVF5FO4N|x-+UG6MkjTuC zh>{3jAFJg2T)o7U{G?R9irfN_0tTB3D*7iAWdWaj57fXq!y$}cUk zRZ;?31P2gzmSmL_m;_|7fox!Am~%Dr;mVc+D}f>mp00i_>zopr00hc3^Z)<= literal 0 HcmV?d00001 diff --git a/src/assets/conveyer_photos/redCircle.png b/src/assets/conveyer_photos/redCircle.png new file mode 100644 index 0000000000000000000000000000000000000000..6b1a7e5d50db8f4c98f599936cd90d87897c80f5 GIT binary patch literal 429 zcmV;e0aE^nP)7tw>&(1M0XLczw&xR>r9hCghB2FU zwi&AevqDCEF0qOc(JU_6bp!2cW`$%v&Z-46;w#=h1wI?78@T->Uh$nP8P2-geiC2h z^$j0n*A2WOzeKJIcr|7EgpW3(6kruk$lA1w%u>M2wxMTd@0oWk5RC}Qh`gVHJ)Knx zVD5nh%+A1G&cJh3fCm#SWOfAhuy=Uf6<}Z@27vbwpaG$=XS{Ky1sJpf%mU0a#GKRf z*2}YQ0Z0e|cY}Zo=5R*~xc9JGAVio1;;nZEj}y)wt^fc4|Nl$5gv|f|00v1!K~w_( X2d0dv&V0TO00000NkvXXu0mjf$H%!^ literal 0 HcmV?d00001 diff --git a/src/assets/conveyer_photos/redTriangle.png b/src/assets/conveyer_photos/redTriangle.png new file mode 100644 index 0000000000000000000000000000000000000000..43c603bde1e3c8e7ad961dfb35bfd6d3147370e5 GIT binary patch literal 373 zcmV-*0gC>KP)lp^H3R~xf07yvU+=Lo4c~83!0cb+ro*95- zB&`|JW41O^*31Cq;;e5I0EtMbnKQ$VHY+_7fDA^RE&xeLW&vTAU2Ufepe@hnsQ@G( z(TE{CXtZ`!fY#E?dJ_P0l6XwnMXRRK1gH&1)T#gwli(j?G|()yssQCs^c>&0qEAA%%2qB&cfF>Sjp8zPXd>;UiK^g&pHeTX!0LaH3X9s`?!blK2@Z13+ z4SU)fB#`wMX7uqA@B9A%iGDO`<-s@n4`9@Ke*pjh|NlCRf8+oF00v1!K~w_(DynJW T&M^Lh00000NkvXXu0mjf>(!CR literal 0 HcmV?d00001 diff --git a/src/index.html b/src/index.html index 5622d2f..d35dc74 100644 --- a/src/index.html +++ b/src/index.html @@ -58,6 +58,7 @@
Conditional:
+ diff --git a/src/js/level1.js b/src/js/level1.js index 09c8357..27e6b60 100644 --- a/src/js/level1.js +++ b/src/js/level1.js @@ -10,6 +10,18 @@ export default class Level1 extends LevelScene { ); } + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") + this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") + this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + } + create() { super.create(); this.addConveyorArtwork(); @@ -31,10 +43,10 @@ export default class Level1 extends LevelScene { { x: 400, y: 200, texture: "ConveyerDown" }, { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "GoalBucket" }, + { x: 200, y: 400, texture: "BlueBucket" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "GoalBucket" }, - { x: 400, y: 500, texture: "GoalBucket" }, + { x: 600, y: 400, texture: "RedBucket" }, + { x: 400, y: 500, texture: "GreenBucket" }, { x: 400, y: 400, texture: "ConveyerAll" }, ]; @@ -46,14 +58,14 @@ export default class Level1 extends LevelScene { setupLevelCandies() { const candies = [ new Candy(Colors.BLUE, Shapes.CIRCLE, Patterns.PLAIN), - new Candy(Colors.RED, Shapes.SQUARE, Patterns.PLAIN), - new Candy(Colors.GREEN, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.CIRCLE, Patterns.PLAIN), ]; const goalPositions = { "blue-circle": { x: 200, y: 400 }, // Left bin - "red-square": { x: 600, y: 400 }, // Right bin - "green-triangle": { x: 400, y: 500 }, // Bottom bin + "red-circle": { x: 600, y: 400 }, // Right bin + "green-circle": { x: 400, y: 500 }, // Bottom bin }; this.setupCandyQueue(candies, goalPositions); diff --git a/src/js/level2.js b/src/js/level2.js index 289f802..bcbce8a 100644 --- a/src/js/level2.js +++ b/src/js/level2.js @@ -6,13 +6,45 @@ export default class Level2 extends LevelScene { super("Level2", "moveDown", false); } - create() { + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") + this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") + this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + this.load.image("LeftBelt", "assets/conveyer_photos/LeftBelt.png") + } + + create() { super.create(); this.addConveyorArtwork(); this.graphics.setDepth(2); } - createLinesForConveyerBelt() { + addConveyorArtwork() { + const tiles = [ + { x: 400, y: 100, texture: "ConveyerDown" }, + { x: 400, y: 200, texture: "ConveyerDown" }, + { x: 400, y: 300, texture: "ConveyerDown" }, + { x: 300, y: 400, texture: "ConveyerLeft" }, + { x: 200, y: 400, texture: "LeftBelt" }, + { x: 200, y: 500, texture: "BlueBucket" }, + { x: 500, y: 400, texture: "ConveyerRight" }, + { x: 600, y: 400, texture: "RedBucket" }, + { x: 400, y: 500, texture: "GreenBucket" }, + { x: 400, y: 400, texture: "ConveyerAll" }, + ]; + + tiles.forEach(({ x, y, texture }) => { + this.add.image(x, y, texture).setDisplaySize(100, 100).setDepth(1); + }); + } + + createLinesForConveyerBelt() { this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); this.pathManager.addLineFrom("left", "downleft", { x: 200, y: 500}); @@ -28,10 +60,10 @@ export default class Level2 extends LevelScene { { x: 300, y: 400, texture: "ConveyerLeft" }, { x: 200, y: 400, texture: "ConveyerCurvedLeft" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "GoalBucket" }, - { x: 400, y: 500, texture: "GoalBucket" }, + { x: 600, y: 400, texture: "RedBucket" }, + { x: 400, y: 500, texture: "GreenBucket" }, { x: 400, y: 400, texture: "ConveyerAll" }, - { x: 200, y: 500, texture: "GoalBucket" }, + { x: 200, y: 500, texture: "BlueBucket" }, ]; tiles.forEach(({ x, y, texture }) => { @@ -56,5 +88,4 @@ export default class Level2 extends LevelScene { this.setupCandyQueue(candies, goalPositions); } - } diff --git a/src/js/level3.js b/src/js/level3.js index 42f032d..8c7781e 100644 --- a/src/js/level3.js +++ b/src/js/level3.js @@ -12,6 +12,36 @@ export default class Level3 extends LevelScene { this.graphics.setDepth(2); } + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") + this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") + this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + } + + addConveyorArtwork() { + const tiles = [ + { x: 400, y: 100, texture: "ConveyerDown" }, + { x: 400, y: 200, texture: "ConveyerDown" }, + { x: 400, y: 300, texture: "ConveyerDown" }, + { x: 300, y: 400, texture: "ConveyerLeft" }, + { x: 200, y: 400, texture: "BlueBucket" }, + { x: 500, y: 400, texture: "ConveyerRight" }, + { x: 600, y: 400, texture: "RedBucket" }, + { x: 400, y: 500, texture: "GreenBucket" }, + { x: 400, y: 400, texture: "ConveyerAll" }, + ]; + + tiles.forEach(({ x, y, texture }) => { + this.add.image(x, y, texture).setDisplaySize(100, 100).setDepth(1); + }); + } + createLinesForConveyerBelt() { this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); @@ -27,10 +57,10 @@ export default class Level3 extends LevelScene { { x: 400, y: 200, texture: "ConveyerDown" }, { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "GoalBucket" }, + { x: 200, y: 400, texture: "BlueBucket" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "GoalBucket" }, - { x: 400, y: 500, texture: "GoalBucket" }, + { x: 600, y: 400, texture: "RedBucket" }, + { x: 400, y: 500, texture: "GreenBucket" }, { x: 400, y: 400, texture: "ConveyerAll" }, ]; diff --git a/src/js/level4.js b/src/js/level4.js new file mode 100644 index 0000000..0de6c01 --- /dev/null +++ b/src/js/level4.js @@ -0,0 +1,118 @@ +import LevelScene from "./SceneClasses/LevelScene.js"; +import Candy, { Colors, Shapes, Patterns } from "./candy.js"; + +export default class Level4 extends LevelScene { + constructor() { + super( + "Level4", + "moveDown", + false, + ); + } + + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("GoalBucket", "assets/conveyer_photos/GoalBucket.png") + this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") + this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") + this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + this.load.image("blueTriangleBucket", "assets/conveyer_photos/blueTriangle.png") + this.load.image("redTriangleBucket", "assets/conveyer_photos/redTriangle.png") + this.load.image("greenTriangleBucket", "assets/conveyer_photos/greenTriangle.png") + this.load.image("blueCircleBucket", "assets/conveyer_photos/blueCircle.png") + this.load.image("redCircleBucket", "assets/conveyer_photos/redCircle.png") + this.load.image("greenCircleBucket", "assets/conveyer_photos/greenCircle.png") + } + + create() { + super.create(); + this.addConveyorArtwork(); + this.graphics.setDepth(2); + } + + addConveyorArtwork() { + const tiles = [ + { x: 400, y: 100, texture: "ConveyerDown" }, + { x: 400, y: 200, texture: "ConveyerDown" }, + { x: 400, y: 300, texture: "ConveyerDown" }, + { x: 300, y: 400, texture: "ConveyerLeft" }, + { x: 200, y: 400, texture: "ConveyerAll" }, + { x: 500, y: 400, texture: "ConveyerRight" }, + { x: 600, y: 400, texture: "ConveyerAll" }, + { x: 400, y: 500, texture: "ConveyerAll" }, + { x: 400, y: 400, texture: "ConveyerAll" }, + { x: 200, y: 500, texture: "BlueBucket" }, + { x: 200, y: 300, texture: "blueTriangleBucket" }, + { x: 100, y: 400, texture: "blueCircleBucket" }, + { x: 700, y: 400, texture: "redCircleBucket" }, + { x: 600, y: 500, texture: "RedBucket" }, + { x: 600, y: 300, texture: "redTriangleBucket" }, + { x: 300, y: 500, texture: "greenTriangleBucket" }, + { x: 400, y: 600, texture: "greenCircleBucket" }, + { x: 500, y: 500, texture: "GreenBucket" }, + ]; + + tiles.forEach(({ x, y, texture }) => { + this.add.image(x, y, texture).setDisplaySize(100, 100).setDepth(1); + }); + } + + createLinesForConveyerBelt() { + this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); + this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); + this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); + this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); + this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + this.pathManager.addLineFrom("left", "leftUp", {x: 200, y: 300}); + this.pathManager.addLineFrom("left", "leftDown", {x: 200, y: 500}); + this.pathManager.addLineFrom("left", "leftLeft", {x: 100, y: 400}); + this.pathManager.addLineFrom("right", "rightUp", {x: 600, y: 300}); + this.pathManager.addLineFrom("right", "rightDown", {x: 600, y: 500}); + this.pathManager.addLineFrom("right", "rightLeft", {x: 700, y: 400}); + this.pathManager.addLineFrom("down", "downDown", {x: 400, y: 600}); + this.pathManager.addLineFrom("down", "downLeft", {x: 300, y: 500}); + this.pathManager.addLineFrom("down", "downRight", {x: 500, y: 500}); + } + + setupLevelCandies() { + let candyOptions = [ + new Candy(Colors.BLUE, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.BLUE, Shapes.SQUARE, Patterns.PLAIN), + new Candy(Colors.BLUE, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.SQUARE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.SQUARE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.TRIANGLE, Patterns.PLAIN), + ]; + + const goalPositions = { + "blue-circle": { x: 100, y: 400 }, + "blue-square": { x: 200, y: 500 }, + "blue-triangle": { x: 200, y: 300 }, + "red-circle": { x: 700, y: 400 }, + "red-square": { x: 600, y: 500 }, + "red-triangle": { x: 600, y: 300 }, + "green-circle": { x: 400, y: 600 }, + "green-square": { x: 500, y: 500 }, + "green-triangle": { x: 300, y: 500 }, + }; + + let candies = []; + + for(let i = 0; i < 3; i++){ + let nextCandy = candyOptions[Math.floor(Math.random() * candyOptions.length)]; + candies.push(nextCandy); + candyOptions = candyOptions.filter(option => option !== nextCandy); + } + + this.setupCandyQueue(candies, goalPositions); + } +} \ No newline at end of file diff --git a/src/js/main.js b/src/js/main.js index 59ea1cb..941ef00 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1,6 +1,7 @@ import Level1 from './level1.js'; import Level2 from './level2.js'; import Level3 from './level3.js'; +import Level4 from './level4.js'; //Here, we import the level files. //Later, we'll want to abstract this process into a function or switch case to call specific levels. @@ -23,7 +24,7 @@ const config = { dom: { createContainer: true, }, - scene: [Level1, Level2, Level3] + scene: [Level1, Level2, Level3, Level4] }; //Setting up the theme for the text editor @@ -58,6 +59,7 @@ levelSelect.addEventListener('change', (event) => { console.log('Level1'); game.scene.stop('Level2'); game.scene.stop('Level3'); + game.scene.stop('Level4'); game.scene.start(scene); break; case '2': @@ -65,6 +67,7 @@ levelSelect.addEventListener('change', (event) => { console.log('Level2'); game.scene.stop('Level1'); game.scene.stop('Level3'); + game.scene.stop('Level4'); game.scene.start(scene); break; // Add more cases for additional levels later when added @@ -73,12 +76,22 @@ levelSelect.addEventListener('change', (event) => { console.log('Level3'); game.scene.stop('Level1'); game.scene.stop('Level2'); + game.scene.stop('Level4'); + game.scene.start(scene); + break; + case '4': + scene = 'Level4'; + console.log('Level4'); + game.scene.stop('Level1'); + game.scene.stop('Level2'); + game.scene.stop('Level3'); game.scene.start(scene); break; default: scene = 'Level1'; game.scene.stop('Level2'); game.scene.stop('Level3'); + game.scene.stop('Level4'); game.scene.start(scene); break; } From 1d4088303a5f3586b8b400717399e848ee410f26 Mon Sep 17 00:00:00 2001 From: AlexSchirack Date: Mon, 16 Nov 2026 19:39:19 -0500 Subject: [PATCH 2/2] Fixed bucket and candy shapes. --- src/js/level1.js | 12 ++++++------ src/js/level2.js | 31 ++++++------------------------- src/js/level3.js | 34 ++++++++-------------------------- 3 files changed, 20 insertions(+), 57 deletions(-) diff --git a/src/js/level1.js b/src/js/level1.js index 27e6b60..60ad6c4 100644 --- a/src/js/level1.js +++ b/src/js/level1.js @@ -17,9 +17,9 @@ export default class Level1 extends LevelScene { this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); - this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") - this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") - this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + this.load.image("BlueCircle", "assets/conveyer_photos/BlueCircle.png") + this.load.image("RedCircle", "assets/conveyer_photos/RedCircle.png") + this.load.image("GreenCircle", "assets/conveyer_photos/GreenCircle.png") } create() { @@ -43,10 +43,10 @@ export default class Level1 extends LevelScene { { x: 400, y: 200, texture: "ConveyerDown" }, { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "BlueBucket" }, + { x: 200, y: 400, texture: "BlueCircle" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "RedBucket" }, - { x: 400, y: 500, texture: "GreenBucket" }, + { x: 600, y: 400, texture: "RedCircle" }, + { x: 400, y: 500, texture: "GreenCircle" }, { x: 400, y: 400, texture: "ConveyerAll" }, ]; diff --git a/src/js/level2.js b/src/js/level2.js index bcbce8a..b955324 100644 --- a/src/js/level2.js +++ b/src/js/level2.js @@ -13,9 +13,9 @@ export default class Level2 extends LevelScene { this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); - this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") - this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") - this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + this.load.image("BlueCircle", "assets/conveyer_photos/BlueCircle.png") + this.load.image("RedCircle", "assets/conveyer_photos/RedCircle.png") + this.load.image("GreenCircle", "assets/conveyer_photos/GreenCircle.png") this.load.image("LeftBelt", "assets/conveyer_photos/LeftBelt.png") } @@ -32,10 +32,10 @@ export default class Level2 extends LevelScene { { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, { x: 200, y: 400, texture: "LeftBelt" }, - { x: 200, y: 500, texture: "BlueBucket" }, + { x: 200, y: 500, texture: "BlueCircle" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "RedBucket" }, - { x: 400, y: 500, texture: "GreenBucket" }, + { x: 600, y: 400, texture: "RedCircle" }, + { x: 400, y: 500, texture: "GreenCircle" }, { x: 400, y: 400, texture: "ConveyerAll" }, ]; @@ -52,25 +52,6 @@ export default class Level2 extends LevelScene { this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); } - addConveyorArtwork() { - const tiles = [ - { x: 400, y: 100, texture: "ConveyerDown" }, - { x: 400, y: 200, texture: "ConveyerDown" }, - { x: 400, y: 300, texture: "ConveyerDown" }, - { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "ConveyerCurvedLeft" }, - { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "RedBucket" }, - { x: 400, y: 500, texture: "GreenBucket" }, - { x: 400, y: 400, texture: "ConveyerAll" }, - { x: 200, y: 500, texture: "BlueBucket" }, - ]; - - tiles.forEach(({ x, y, texture }) => { - this.add.image(x, y, texture).setDisplaySize(100, 100).setDepth(1); - }); - } - setupLevelCandies() { //Define the candies for this level const candies = [ diff --git a/src/js/level3.js b/src/js/level3.js index 8c7781e..6e1ed2e 100644 --- a/src/js/level3.js +++ b/src/js/level3.js @@ -19,9 +19,9 @@ export default class Level3 extends LevelScene { this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); - this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") - this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") - this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + this.load.image("BlueCircle", "assets/conveyer_photos/BlueCircle.png") + this.load.image("RedCircle", "assets/conveyer_photos/RedCircle.png") + this.load.image("GreenCircle", "assets/conveyer_photos/GreenCircle.png") } addConveyorArtwork() { @@ -30,10 +30,10 @@ export default class Level3 extends LevelScene { { x: 400, y: 200, texture: "ConveyerDown" }, { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "BlueBucket" }, + { x: 200, y: 400, texture: "BlueCircle" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "RedBucket" }, - { x: 400, y: 500, texture: "GreenBucket" }, + { x: 600, y: 400, texture: "RedCircle" }, + { x: 400, y: 500, texture: "GreenCircle" }, { x: 400, y: 400, texture: "ConveyerAll" }, ]; @@ -51,29 +51,11 @@ export default class Level3 extends LevelScene { this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); } - addConveyorArtwork() { - const tiles = [ - { x: 400, y: 100, texture: "ConveyerDown" }, - { x: 400, y: 200, texture: "ConveyerDown" }, - { x: 400, y: 300, texture: "ConveyerDown" }, - { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "BlueBucket" }, - { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "RedBucket" }, - { x: 400, y: 500, texture: "GreenBucket" }, - { x: 400, y: 400, texture: "ConveyerAll" }, - ]; - - tiles.forEach(({ x, y, texture }) => { - this.add.image(x, y, texture).setDisplaySize(100, 100).setDepth(1); - }); - } - setupLevelCandies() { let candyOptions = [ new Candy(Colors.BLUE, Shapes.CIRCLE, Patterns.PLAIN), - new Candy(Colors.RED, Shapes.SQUARE, Patterns.PLAIN), - new Candy(Colors.GREEN, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.CIRCLE, Patterns.PLAIN), ] const goalPositions = {