unblockjam: rewrite packs code so that they can be created independently #3
- Commit
5691605db87a3fe628073b3b5f184e5bbd231ec9- Author
- Vayun Mathur <[email protected]>
- When
- 2026-04-01 20:41 UTC (8 months ago)
- Parents
63437a0
Diff
games/unblockjam/src/main/assets/levels.json
diff --git a/games/unblockjam/src/main/assets/levels.json b/games/unblockjam/src/main/assets/levels.jsonindex 124eacf680..24ae766a27 100644--- a/games/unblockjam/src/main/assets/levels.json+++ b/games/unblockjam/src/main/assets/levels.json@@ -1,5 +1,6 @@ [ {+ "id": 0, "b": [ { "y": 2,@@ -22,6 +23,7 @@ "c": 2 }, {+ "id": 1, "b": [ { "y": 2,@@ -50,6 +52,7 @@ "c": 3 }, {+ "id": 2, "b": [ { "y": 2,@@ -83,6 +86,7 @@ "c": 4 }, {+ "id": 3, "b": [ { "y": 2,@@ -122,6 +126,7 @@ "c": 4 }, {+ "id": 4, "b": [ { "y": 2,@@ -161,6 +166,7 @@ "c": 5 }, {+ "id": 5, "b": [ { "y": 2,@@ -217,6 +223,7 @@ "c": 4 }, {+ "id": 6, "b": [ { "x": 1,@@ -262,6 +269,7 @@ "c": 4 }, {+ "id": 7, "b": [ { "y": 2,@@ -306,6 +314,7 @@ "c": 4 }, {+ "id": 8, "b": [ { "y": 2,@@ -356,6 +365,7 @@ "c": 4 }, {+ "id": 9, "b": [ { "y": 2,@@ -406,6 +416,7 @@ "c": 4 }, {+ "id": 10, "b": [ { "y": 2,@@ -457,6 +468,7 @@ "c": 5 }, {+ "id": 11, "b": [ { "y": 2,@@ -507,6 +519,7 @@ "c": 5 }, {+ "id": 12, "b": [ { "y": 2,@@ -550,6 +563,7 @@ "c": 4 }, {+ "id": 13, "b": [ { "x": 1,@@ -596,6 +610,7 @@ "c": 5 }, {+ "id": 14, "b": [ { "x": 2,@@ -653,6 +668,7 @@ "c": 4 }, {+ "id": 15, "b": [ { "y": 3,@@ -699,6 +715,7 @@ "c": 5 }, {+ "id": 16, "b": [ { "y": 3,@@ -750,6 +767,7 @@ "c": 5 }, {+ "id": 17, "b": [ { "y": 3,@@ -801,6 +819,7 @@ "c": 6 }, {+ "id": 18, "b": [ { "y": 3,@@ -844,6 +863,7 @@ "c": 5 }, {+ "id": 19, "b": [ { "y": 3,@@ -889,6 +909,7 @@ "c": 5 }, {+ "id": 20, "b": [ { "y": 2,@@ -933,6 +954,7 @@ "c": 5 }, {+ "id": 21, "b": [ { "y": 2,@@ -985,6 +1007,7 @@ "c": 7 }, {+ "id": 22, "b": [ { "y": 2,@@ -1050,6 +1073,7 @@ "c": 9 }, {+ "id": 23, "b": [ { "x": 1,@@ -1110,6 +1134,7 @@ "c": 7 }, {+ "id": 24, "b": [ { "x": 1,@@ -1171,6 +1196,7 @@ "c": 8 }, {+ "id": 25, "b": [ { "y": 3,@@ -1240,6 +1266,7 @@ "c": 9 }, {+ "id": 26, "b": [ { "y": 3,@@ -1290,6 +1317,7 @@ "c": 7 }, {+ "id": 27, "b": [ { "x": 1,@@ -1345,6 +1373,7 @@ "c": 7 }, {+ "id": 28, "b": [ { "y": 3,@@ -1400,6 +1429,7 @@ "c": 7 }, {+ "id": 29, "b": [ { "x": 1,@@ -1457,6 +1487,7 @@ "c": 8 }, {+ "id": 30, "b": [ { "x": 1,@@ -1518,6 +1549,7 @@ "c": 8 }, {+ "id": 31, "b": [ { "x": 2,@@ -1579,6 +1611,7 @@ "c": 8 }, {+ "id": 32, "b": [ { "y": 3,@@ -1639,6 +1672,7 @@ "c": 8 }, {+ "id": 33, "b": [ { "y": 3,@@ -1705,6 +1739,7 @@ "c": 6 }, {+ "id": 34, "b": [ { "x": 1,@@ -1772,6 +1807,7 @@ "c": 8 }, {+ "id": 35, "b": [ { "y": 3,@@ -1839,6 +1875,7 @@ "c": 8 }, {+ "id": 36, "b": [ { "x": 1,@@ -1905,6 +1942,7 @@ "c": 9 }, {+ "id": 37, "b": [ { "x": 1,@@ -1966,6 +2004,7 @@ "c": 10 }, {+ "id": 38, "b": [ { "y": 3,@@ -2037,6 +2076,7 @@ "c": 8 }, {+ "id": 39, "b": [ { "y": 3,@@ -2108,6 +2148,7 @@ "c": 8 }, {+ "id": 40, "b": [ { "y": 3,@@ -2159,6 +2200,7 @@ "c": 7 }, {+ "id": 41, "b": [ { "y": 3,@@ -2214,6 +2256,7 @@ "c": 7 }, {+ "id": 42, "b": [ { "x": 1,@@ -2276,6 +2319,7 @@ "c": 5 }, {+ "id": 43, "b": [ { "y": 3,@@ -2323,6 +2367,7 @@ "c": 8 }, {+ "id": 44, "b": [ { "y": 3,@@ -2379,6 +2424,7 @@ "c": 8 }, {+ "id": 45, "b": [ { "y": 3,@@ -2433,6 +2479,7 @@ "c": 8 }, {+ "id": 46, "b": [ { "y": 3,@@ -2482,6 +2529,7 @@ "c": 9 }, {+ "id": 47, "b": [ { "y": 3,@@ -2539,6 +2587,7 @@ "c": 9 }, {+ "id": 48, "b": [ { "x": 2,@@ -2604,6 +2653,7 @@ "c": 8 }, {+ "id": 49, "b": [ { "y": 3,@@ -2666,6 +2716,7 @@ "c": 9 }, {+ "id": 50, "b": [ { "x": 1,@@ -2732,6 +2783,7 @@ "c": 9 }, {+ "id": 51, "b": [ { "y": 3,@@ -2798,6 +2850,7 @@ "c": 9 }, {+ "id": 52, "b": [ { "y": 3,@@ -2865,6 +2918,7 @@ "c": 9 }, {+ "id": 53, "b": [ { "y": 3,@@ -2932,6 +2986,7 @@ "c": 10 }, {+ "id": 54, "b": [ { "y": 3,@@ -3000,6 +3055,7 @@ "c": 10 }, {+ "id": 55, "b": [ { "y": 3,@@ -3050,6 +3106,7 @@ "c": 7 }, {+ "id": 56, "b": [ { "y": 3,@@ -3099,6 +3156,7 @@ "c": 8 }, {+ "id": 57, "b": [ { "y": 3,@@ -3153,6 +3211,7 @@ "c": 9 }, {+ "id": 58, "b": [ { "y": 3,@@ -3209,6 +3268,7 @@ "c": 10 }, {+ "id": 59, "b": [ { "y": 3,@@ -3268,6 +3328,7 @@ "c": 9 }, {+ "id": 60, "b": [ { "y": 3,@@ -3329,6 +3390,7 @@ "c": 10 }, {+ "id": 61, "b": [ { "y": 3,@@ -3389,6 +3451,7 @@ "c": 10 }, {+ "id": 62, "b": [ { "y": 3,@@ -3451,6 +3514,7 @@ "c": 10 }, {+ "id": 63, "b": [ { "y": 3,@@ -3501,6 +3565,7 @@ "c": 7 }, {+ "id": 64, "b": [ { "y": 3,@@ -3550,6 +3615,7 @@ "c": 7 }, {+ "id": 65, "b": [ { "y": 2,@@ -3604,6 +3670,7 @@ "c": 8 }, {+ "id": 66, "b": [ { "y": 3,@@ -3659,6 +3726,7 @@ "c": 9 }, {+ "id": 67, "b": [ { "y": 2,@@ -3719,6 +3787,7 @@ "c": 9 }, {+ "id": 68, "b": [ { "y": 2,@@ -3774,6 +3843,7 @@ "c": 9 }, {+ "id": 69, "b": [ { "y": 2,@@ -3834,6 +3904,7 @@ "c": 9 }, {+ "id": 70, "b": [ { "y": 3,@@ -3895,6 +3966,7 @@ "c": 11 }, {+ "id": 71, "b": [ { "y": 3,@@ -3954,6 +4026,7 @@ "c": 12 }, {+ "id": 72, "b": [ { "y": 3,@@ -4026,6 +4099,7 @@ "c": 12 }, {+ "id": 73, "b": [ { "y": 3,@@ -4108,6 +4182,7 @@ "c": 12 }, {+ "id": 74, "b": [ { "y": 3,@@ -4174,6 +4249,7 @@ "c": 11 }, {+ "id": 75, "b": [ { "y": 3,@@ -4240,6 +4316,7 @@ "c": 12 }, {+ "id": 76, "b": [ { "y": 3,@@ -4306,6 +4383,7 @@ "c": 15 }, {+ "id": 77, "b": [ { "y": 3,@@ -4395,6 +4473,7 @@ "c": 13 }, {+ "id": 78, "b": [ { "y": 3,@@ -4456,6 +4535,7 @@ "c": 10 }, {+ "id": 79, "b": [ { "y": 3,@@ -4540,6 +4620,7 @@ "c": 10 }, {+ "id": 80, "b": [ { "y": 3,@@ -4613,6 +4694,7 @@ "c": 12 }, {+ "id": 81, "b": [ { "y": 3,@@ -4689,6 +4771,7 @@ "c": 13 }, {+ "id": 82, "b": [ { "y": 3,@@ -4749,6 +4832,7 @@ "c": 10 }, {+ "id": 83, "b": [ { "y": 3,@@ -4809,6 +4893,7 @@ "c": 12 }, {+ "id": 84, "b": [ { "y": 3,@@ -4886,6 +4971,7 @@ "c": 12 }, {+ "id": 85, "b": [ { "y": 3,@@ -4968,6 +5054,7 @@ "c": 15 }, {+ "id": 86, "b": [ { "y": 3,@@ -5024,6 +5111,7 @@ "c": 10 }, {+ "id": 87, "b": [ { "y": 3,@@ -5084,6 +5172,7 @@ "c": 10 }, {+ "id": 88, "b": [ { "y": 3,@@ -5143,6 +5232,7 @@ "c": 12 }, {+ "id": 89, "b": [ { "y": 3,@@ -5216,6 +5306,7 @@ "c": 12 }, {+ "id": 90, "b": [ { "y": 3,@@ -5293,6 +5384,7 @@ "c": 13 }, {+ "id": 91, "b": [ { "y": 3,@@ -5370,6 +5462,7 @@ "c": 15 }, {+ "id": 92, "b": [ { "y": 3,@@ -5431,6 +5524,7 @@ "c": 11 }, {+ "id": 93, "b": [ { "y": 3,@@ -5492,6 +5586,7 @@ "c": 13 }, {+ "id": 94, "b": [ { "y": 3,@@ -5565,6 +5660,7 @@ "c": 13 }, {+ "id": 95, "b": [ { "y": 3,@@ -5647,6 +5743,7 @@ "c": 13 }, {+ "id": 96, "b": [ { "y": 3,@@ -5730,6 +5827,7 @@ "c": 15 }, {+ "id": 97, "b": [ { "y": 3,@@ -5778,6 +5876,7 @@ "c": 12 }, {+ "id": 98, "b": [ { "y": 3,@@ -5839,6 +5938,7 @@ "c": 11 }, {+ "id": 99, "b": [ { "y": 3,@@ -5901,6 +6001,7 @@ "c": 13 }, {+ "id": 100, "b": [ { "y": 3,@@ -5968,6 +6069,7 @@ "c": 11 }, {+ "id": 101, "b": [ { "y": 3,@@ -6047,6 +6149,7 @@ "c": 11 }, {+ "id": 102, "b": [ { "y": 3,@@ -6129,6 +6232,7 @@ "c": 12 }, {+ "id": 103, "b": [ { "y": 3,@@ -6214,6 +6318,7 @@ "c": 13 }, {+ "id": 104, "b": [ { "y": 3,@@ -6269,6 +6374,7 @@ "c": 10 }, {+ "id": 105, "b": [ { "y": 3,@@ -6330,6 +6436,7 @@ "c": 11 }, {+ "id": 106, "b": [ { "y": 3,@@ -6389,6 +6496,7 @@ "c": 12 }, {+ "id": 107, "b": [ { "y": 3,@@ -6461,6 +6569,7 @@ "c": 12 }, {+ "id": 108, "b": [ { "y": 3,@@ -6543,6 +6652,7 @@ "c": 12 }, {+ "id": 109, "b": [ { "y": 3,@@ -6609,6 +6719,7 @@ "c": 11 }, {+ "id": 110, "b": [ { "y": 3,@@ -6675,6 +6786,7 @@ "c": 12 }, {+ "id": 111, "b": [ { "y": 3,@@ -6741,6 +6853,7 @@ "c": 15 }, {+ "id": 112, "b": [ { "y": 3,@@ -6830,6 +6943,7 @@ "c": 13 }, {+ "id": 113, "b": [ { "y": 3,@@ -6891,6 +7005,7 @@ "c": 10 }, {+ "id": 114, "b": [ { "y": 3,@@ -6975,6 +7090,7 @@ "c": 10 }, {+ "id": 115, "b": [ { "y": 3,@@ -7048,6 +7164,7 @@ "c": 12 }, {+ "id": 116, "b": [ { "y": 3,@@ -7124,6 +7241,7 @@ "c": 13 }, {+ "id": 117, "b": [ { "y": 3,@@ -7184,6 +7302,7 @@ "c": 10 }, {+ "id": 118, "b": [ { "y": 3,@@ -7244,6 +7363,7 @@ "c": 12 }, {+ "id": 119, "b": [ { "y": 3,@@ -7321,6 +7441,7 @@ "c": 12 }, {+ "id": 120, "b": [ { "y": 3,@@ -7403,6 +7524,7 @@ "c": 15 }, {+ "id": 121, "b": [ { "y": 3,@@ -7459,6 +7581,7 @@ "c": 10 }, {+ "id": 122, "b": [ { "y": 3,@@ -7519,6 +7642,7 @@ "c": 10 }, {+ "id": 123, "b": [ { "y": 3,@@ -7578,6 +7702,7 @@ "c": 12 }, {+ "id": 124, "b": [ { "y": 3,@@ -7651,6 +7776,7 @@ "c": 12 }, {+ "id": 125, "b": [ { "y": 3,@@ -7728,6 +7854,7 @@ "c": 13 }, {+ "id": 126, "b": [ { "y": 3,@@ -7805,6 +7932,7 @@ "c": 15 }, {+ "id": 127, "b": [ { "y": 3,@@ -7866,6 +7994,7 @@ "c": 11 }, {+ "id": 128, "b": [ { "y": 3,@@ -7927,6 +8056,7 @@ "c": 13 }, {+ "id": 129, "b": [ { "y": 3,@@ -8000,6 +8130,7 @@ "c": 13 }, {+ "id": 130, "b": [ { "y": 3,@@ -8082,6 +8213,7 @@ "c": 13 }, {+ "id": 131, "b": [ { "y": 3,@@ -8165,6 +8297,7 @@ "c": 15 }, {+ "id": 132, "b": [ { "y": 3,@@ -8213,6 +8346,7 @@ "c": 12 }, {+ "id": 133, "b": [ { "y": 3,@@ -8274,6 +8408,7 @@ "c": 11 }, {+ "id": 134, "b": [ { "y": 3,@@ -8336,6 +8471,7 @@ "c": 13 }, {+ "id": 135, "b": [ { "y": 3,@@ -8402,6 +8538,7 @@ "c": 11 }, {+ "id": 136, "b": [ { "y": 3,@@ -8485,6 +8622,7 @@ "c": 11 }, {+ "id": 137, "b": [ { "y": 3,@@ -8568,6 +8706,7 @@ "c": 11 }, {+ "id": 138, "b": [ { "y": 3,@@ -8618,6 +8757,7 @@ "c": 10 }, {+ "id": 139, "b": [ { "y": 3,@@ -8677,6 +8817,7 @@ "c": 10 }, {+ "id": 140, "b": [ { "y": 3,@@ -8743,6 +8884,7 @@ "c": 10 }, {+ "id": 141, "b": [ { "y": 3,@@ -8814,6 +8956,7 @@ "c": 11 }, {+ "id": 142, "b": [ { "y": 3,@@ -8885,6 +9028,7 @@ "c": 13 }, {+ "id": 143, "b": [ { "y": 3,@@ -8973,6 +9117,7 @@ "c": 15 }, {+ "id": 144, "b": [ { "y": 3,@@ -9045,6 +9190,7 @@ "c": 11 }, {+ "id": 145, "b": [ { "y": 3,@@ -9123,6 +9269,7 @@ "c": 12 }, {+ "id": 146, "b": [ { "y": 3,@@ -9206,6 +9353,7 @@ "c": 12 }, {+ "id": 147, "b": [ { "y": 3,@@ -9291,6 +9439,7 @@ "c": 15 }, {+ "id": 148, "b": [ { "y": 3,@@ -9356,6 +9505,7 @@ "c": 10 }, {+ "id": 149, "b": [ { "y": 3,@@ -9427,6 +9577,7 @@ "c": 12 }, {+ "id": 150, "b": [ { "y": 3,@@ -9484,6 +9635,7 @@ "c": 15 }, {+ "id": 151, "b": [ { "x": 2,@@ -9551,6 +9703,7 @@ "c": 17 }, {+ "id": 152, "b": [ { "y": 3,@@ -9625,6 +9778,7 @@ "c": 16 }, {+ "id": 153, "b": [ { "x": 3,@@ -9715,6 +9869,7 @@ "c": 16 }, {+ "id": 154, "b": [ { "x": 2,@@ -9777,6 +9932,7 @@ "c": 15 }, {+ "id": 155, "b": [ { "x": 2,@@ -9844,6 +10000,7 @@ "c": 16 }, {+ "id": 156, "b": [ { "x": 2,@@ -9928,6 +10085,7 @@ "c": 15 }, {+ "id": 157, "b": [ { "x": 2,@@ -10005,6 +10163,7 @@ "c": 16 }, {+ "id": 158, "b": [ { "y": 3,@@ -10088,6 +10247,7 @@ "c": 15 }, {+ "id": 159, "b": [ { "y": 3,@@ -10166,6 +10326,7 @@ "c": 15 }, {+ "id": 160, "b": [ { "y": 3,@@ -10233,6 +10394,7 @@ "c": 20 }, {+ "id": 161, "b": [ { "y": 3,@@ -10292,6 +10454,7 @@ "c": 15 }, {+ "id": 162, "b": [ { "y": 3,@@ -10369,6 +10532,7 @@ "c": 15 }, {+ "id": 163, "b": [ { "y": 3,@@ -10444,6 +10608,7 @@ "c": 19 }, {+ "id": 164, "b": [ { "x": 1,@@ -10528,6 +10693,7 @@ "c": 16 }, {+ "id": 165, "b": [ { "y": 3,@@ -10610,6 +10776,7 @@ "c": 17 }, {+ "id": 166, "b": [ { "y": 3,@@ -10688,6 +10855,7 @@ "c": 15 }, {+ "id": 167, "b": [ { "y": 3,@@ -10754,6 +10922,7 @@ "c": 16 }, {+ "id": 168, "b": [ { "y": 3,@@ -10822,6 +10991,7 @@ "c": 17 }, {+ "id": 169, "b": [ { "y": 3,@@ -10895,6 +11065,7 @@ "c": 16 }, {+ "id": 170, "b": [ { "x": 1,@@ -10963,6 +11134,7 @@ "c": 15 }, {+ "id": 171, "b": [ { "y": 3,@@ -11052,6 +11224,7 @@ "c": 15 }, {+ "id": 172, "b": [ { "x": 1,@@ -11121,6 +11294,7 @@ "c": 15 }, {+ "id": 173, "b": [ { "x": 1,@@ -11197,6 +11371,7 @@ "c": 15 }, {+ "id": 174, "b": [ { "y": 3,@@ -11271,6 +11446,7 @@ "c": 19 }, {+ "id": 175, "b": [ { "y": 3,@@ -11342,6 +11518,7 @@ "c": 17 }, {+ "id": 176, "b": [ { "x": 2,@@ -11413,6 +11590,7 @@ "c": 18 }, {+ "id": 177, "b": [ { "y": 3,@@ -11496,6 +11674,7 @@ "c": 16 }, {+ "id": 178, "b": [ { "x": 3,@@ -11583,6 +11762,7 @@ "c": 15 }, {+ "id": 179, "b": [ { "x": 2,@@ -11661,6 +11841,7 @@ "c": 17 }, {+ "id": 180, "b": [ { "y": 3,@@ -11739,6 +11920,7 @@ "c": 15 }, {+ "id": 181, "b": [ { "y": 3,@@ -11811,6 +11993,7 @@ "c": 15 }, {+ "id": 182, "b": [ { "x": 2,@@ -11884,6 +12067,7 @@ "c": 20 }, {+ "id": 183, "b": [ { "x": 1,@@ -11962,6 +12146,7 @@ "c": 16 }, {+ "id": 184, "b": [ { "y": 3,@@ -12036,6 +12221,7 @@ "c": 19 }, {+ "id": 185, "b": [ { "y": 3,@@ -12109,6 +12295,7 @@ "c": 19 }, {+ "id": 186, "b": [ { "y": 3,@@ -12182,6 +12369,7 @@ "c": 18 }, {+ "id": 187, "b": [ { "y": 3,@@ -12254,6 +12442,7 @@ "c": 18 }, {+ "id": 188, "b": [ { "y": 3,@@ -12325,6 +12514,7 @@ "c": 16 }, {+ "id": 189, "b": [ { "y": 3,@@ -12406,6 +12596,7 @@ "c": 16 }, {+ "id": 190, "b": [ { "y": 3,@@ -12494,6 +12685,7 @@ "c": 15 }, {+ "id": 191, "b": [ { "y": 3,@@ -12561,6 +12753,7 @@ "c": 16 }, {+ "id": 192, "b": [ { "x": 2,@@ -12640,6 +12833,7 @@ "c": 18 }, {+ "id": 193, "b": [ { "y": 3,@@ -12718,6 +12912,7 @@ "c": 17 }, {+ "id": 194, "b": [ { "x": 1,@@ -12795,6 +12990,7 @@ "c": 18 }, {+ "id": 195, "b": [ { "y": 3,@@ -12866,6 +13062,7 @@ "c": 19 }, {+ "id": 196, "b": [ { "y": 3,@@ -12949,6 +13146,7 @@ "c": 17 }, {+ "id": 197, "b": [ { "y": 3,@@ -13021,6 +13219,7 @@ "c": 16 }, {+ "id": 198, "b": [ { "x": 1,@@ -13095,6 +13294,7 @@ "c": 15 }, {+ "id": 199, "b": [ { "x": 1,@@ -13172,6 +13372,7 @@ "c": 15 }, {+ "id": 200, "b": [ { "y": 3,@@ -13243,6 +13444,7 @@ "c": 21 }, {+ "id": 201, "b": [ { "x": 1,@@ -13321,6 +13523,7 @@ "c": 24 }, {+ "id": 202, "b": [ { "y": 3,@@ -13398,6 +13601,7 @@ "c": 22 }, {+ "id": 203, "b": [ { "x": 1,@@ -13470,6 +13674,7 @@ "c": 25 }, {+ "id": 204, "b": [ { "y": 3,@@ -13541,6 +13746,7 @@ "c": 22 }, {+ "id": 205, "b": [ { "y": 3,@@ -13616,6 +13822,7 @@ "c": 25 }, {+ "id": 206, "b": [ { "x": 1,@@ -13693,6 +13900,7 @@ "c": 24 }, {+ "id": 207, "b": [ { "y": 3,@@ -13762,6 +13970,7 @@ "c": 21 }, {+ "id": 208, "b": [ { "y": 3,@@ -13840,6 +14049,7 @@ "c": 23 }, {+ "id": 209, "b": [ { "y": 3,@@ -13924,6 +14134,7 @@ "c": 22 }, {+ "id": 210, "b": [ { "x": 2,@@ -14000,6 +14211,7 @@ "c": 21 }, {+ "id": 211, "b": [ { "x": 1,@@ -14060,6 +14272,7 @@ "c": 21 }, {+ "id": 212, "b": [ { "x": 3,@@ -14136,6 +14349,7 @@ "c": 23 }, {+ "id": 213, "b": [ { "y": 3,@@ -14214,6 +14428,7 @@ "c": 22 }, {+ "id": 214, "b": [ { "x": 2,@@ -14288,6 +14503,7 @@ "c": 24 }, {+ "id": 215, "b": [ { "x": 2,@@ -14372,6 +14588,7 @@ "c": 25 }, {+ "id": 216, "b": [ { "y": 3,@@ -14449,6 +14666,7 @@ "c": 21 }, {+ "id": 217, "b": [ { "x": 2,@@ -14522,6 +14740,7 @@ "c": 21 }, {+ "id": 218, "b": [ { "y": 3,@@ -14604,6 +14823,7 @@ "c": 22 }, {+ "id": 219, "b": [ { "x": 2,@@ -14677,6 +14897,7 @@ "c": 22 }, {+ "id": 220, "b": [ { "y": 3,@@ -14743,6 +14964,7 @@ "c": 22 }, {+ "id": 221, "b": [ { "x": 1,@@ -14816,6 +15038,7 @@ "c": 22 }, {+ "id": 222, "b": [ { "y": 3,@@ -14895,6 +15118,7 @@ "c": 23 }, {+ "id": 223, "b": [ { "y": 3,@@ -14971,6 +15195,7 @@ "c": 23 }, {+ "id": 224, "b": [ { "y": 3,@@ -15056,6 +15281,7 @@ "c": 22 }, {+ "id": 225, "b": [ { "y": 3,@@ -15121,6 +15347,7 @@ "c": 23 }, {+ "id": 226, "b": [ { "x": 1,@@ -15192,6 +15419,7 @@ "c": 24 }, {+ "id": 227, "b": [ { "x": 2,@@ -15260,6 +15488,7 @@ "c": 22 }, {+ "id": 228, "b": [ { "x": 3,@@ -15342,6 +15571,7 @@ "c": 24 }, {+ "id": 229, "b": [ { "y": 3,@@ -15414,6 +15644,7 @@ "c": 22 }, {+ "id": 230, "b": [ { "y": 3,@@ -15490,6 +15721,7 @@ "c": 21 }, {+ "id": 231, "b": [ { "x": 2,@@ -15572,6 +15804,7 @@ "c": 22 }, {+ "id": 232, "b": [ { "x": 3,@@ -15656,6 +15889,7 @@ "c": 24 }, {+ "id": 233, "b": [ { "x": 3,@@ -15728,6 +15962,7 @@ "c": 21 }, {+ "id": 234, "b": [ { "y": 3,@@ -15796,6 +16031,7 @@ "c": 21 }, {+ "id": 235, "b": [ { "y": 3,@@ -15877,6 +16113,7 @@ "c": 22 }, {+ "id": 236, "b": [ { "y": 3,@@ -15953,6 +16190,7 @@ "c": 21 }, {+ "id": 237, "b": [ { "x": 3,@@ -16030,6 +16268,7 @@ "c": 21 }, {+ "id": 238, "b": [ { "x": 2,@@ -16093,6 +16332,7 @@ "c": 21 }, {+ "id": 239, "b": [ { "x": 1,@@ -16170,6 +16410,7 @@ "c": 25 }, {+ "id": 240, "b": [ { "y": 3,@@ -16249,6 +16490,7 @@ "c": 21 }, {+ "id": 241, "b": [ { "y": 3,@@ -16338,6 +16580,7 @@ "c": 21 }, {+ "id": 242, "b": [ { "y": 3,@@ -16411,6 +16654,7 @@ "c": 24 }, {+ "id": 243, "b": [ { "x": 1,@@ -16488,6 +16732,7 @@ "c": 25 }, {+ "id": 244, "b": [ { "y": 3,@@ -16559,6 +16804,7 @@ "c": 21 }, {+ "id": 245, "b": [ { "x": 1,@@ -16636,6 +16882,7 @@ "c": 22 }, {+ "id": 246, "b": [ { "x": 1,@@ -16716,6 +16963,7 @@ "c": 22 }, {+ "id": 247, "b": [ { "y": 3,@@ -16786,6 +17034,7 @@ "c": 21 }, {+ "id": 248, "b": [ { "x": 2,@@ -16863,6 +17112,7 @@ "c": 21 }, {+ "id": 249, "b": [ { "x": 1,
games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/LevelData.kt
diff --git a/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/LevelData.kt b/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/LevelData.ktindex 59cbdaaa1c..304d3f6b89 100644--- a/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/LevelData.kt+++ b/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/LevelData.kt@@ -7,6 +7,7 @@ import kotlinx.serialization.json.int import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive+import kotlinx.serialization.json.long data class Coord( val x: Int,@@ -23,79 +24,58 @@ data class Block( val dimension: Dimension ) -/*-{- "b": [- {- "y": 2,- "w": 2,- "h": 1- },- {- "x": 2,- "y": 2,- "w": 1,- "h": 2- }- ],- "e": {- "x": 4,- "y": 2- },- "w": 4,- "h": 4,- "c": 2- }- */--data class LevelData(- val dimension: Dimension,- val exit: Coord,- val blocks: List<Block>,- val optimalMoves: Int,- val lastMovedBlockIndex: Int? = null+data class LevelPack(+ val name: String,+ val levels: List<LevelData> ) { companion object { - var LEVELS = listOf<LevelData>()+ var PACKS: List<LevelPack> = listOf() private set - private fun fromJson(json: JsonObject): LevelData {- val dimension = Dimension(- json["w"]!!.jsonPrimitive.int,- json["h"]!!.jsonPrimitive.int- )- val exit = Coord(- json["e"]!!.jsonObject["x"]!!.jsonPrimitive.int,- dimension.height - (json["e"]!!.jsonObject["y"]!!.jsonPrimitive.int) - 1- )- val blocks = json["b"]!!.jsonArray.map {- val block = it.jsonObject- val blockDim = Dimension(- block["w"]!!.jsonPrimitive.int,- block["h"]!!.jsonPrimitive.int- )- val y = block["y"]?.jsonPrimitive?.int ?: 0- Block(- Coord(- block["x"]?.jsonPrimitive?.int ?: 0,- dimension.height - y - blockDim.height- ),- blockDim- )- }- val optimalMoves = json["c"]!!.jsonPrimitive.int- return LevelData(dimension, exit, blocks, optimalMoves)- }- fun init(context: Context) { val json = context.assets.open("levels.json").bufferedReader().readText()- LEVELS = Json.parseToJsonElement(json).jsonArray.map {+ PACKS = listOf(LevelPack("Original Pack", Json.parseToJsonElement(json).jsonArray.map { fromJson(it.jsonObject)- }+ })) }-- // to be 250, 1000, 1000, 1000, everything else- val PACKS = listOf("Original Pack" to 250, "Extended Pack 1" to 0, "Extended Pack 2" to 0, "Extended Pack 3" to 0, "Infinite Pack" to 0) } }++data class LevelData(+ val id: Long,+ val dimension: Dimension,+ val exit: Coord,+ val blocks: List<Block>,+ val optimalMoves: Int,+ val lastMovedBlockIndex: Int? = null+)++private fun fromJson(json: JsonObject): LevelData {+ val id = json["id"]!!.jsonPrimitive.long+ val dimension = Dimension(+ json["w"]!!.jsonPrimitive.int,+ json["h"]!!.jsonPrimitive.int+ )+ val exit = Coord(+ json["e"]!!.jsonObject["x"]!!.jsonPrimitive.int,+ dimension.height - (json["e"]!!.jsonObject["y"]!!.jsonPrimitive.int) - 1+ )+ val blocks = json["b"]!!.jsonArray.map {+ val block = it.jsonObject+ val blockDim = Dimension(+ block["w"]!!.jsonPrimitive.int,+ block["h"]!!.jsonPrimitive.int+ )+ val y = block["y"]?.jsonPrimitive?.int ?: 0+ Block(+ Coord(+ block["x"]?.jsonPrimitive?.int ?: 0,+ dimension.height - y - blockDim.height+ ),+ blockDim+ )+ }+ val optimalMoves = json["c"]!!.jsonPrimitive.int+ return LevelData(id, dimension, exit, blocks, optimalMoves)+}\ No newline at end of file
games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/MainActivity.kt
diff --git a/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/MainActivity.kt b/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/MainActivity.ktindex c4ea3a9991..0668bc1065 100644--- a/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/MainActivity.kt+++ b/games/unblockjam/src/main/java/com/vayunmathur/games/unblockjam/MainActivity.kt@@ -48,7 +48,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.pointer.pointerInput-import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalWindowInfo import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource@@ -75,7 +74,7 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge()- LevelData.init(this)+ LevelPack.init(this) completedLevelsRepository = CompletedLevelsRepository(this) setContent { UnblockJamTheme {@@ -92,7 +91,7 @@ sealed interface Route: NavKey { @Serializable data class LevelSelector(val packIndex: Int): Route @Serializable- data class Game(val levelIndex: Int): Route+ data class Game(val packIndex: Int, val levelIndex: Int): Route } @Composable@@ -106,7 +105,7 @@ fun Navigation(completedLevelsRepository: CompletedLevelsRepository) { LevelScreen(backStack, completedLevelsRepository, it.packIndex) } entry<Route.Game> {- GameScreen(backStack, completedLevelsRepository, it.levelIndex)+ GameScreen(backStack, completedLevelsRepository, it.packIndex, it.levelIndex) } } }@@ -122,12 +121,12 @@ fun PackScreen(backStack: NavBackStack<Route>) { contentPadding = paddingValues + PaddingValues(start = 16.dp, top = 16.dp, end = 16.dp, bottom = 0.dp), verticalArrangement = Arrangement.spacedBy(12.dp), ) {- itemsIndexed(LevelData.PACKS) { index, pack ->+ itemsIndexed(LevelPack.PACKS) { index, pack -> Card(Modifier.clickable{ backStack.add(Route.LevelSelector(index)) }, colors = CardDefaults.cardColors(MaterialTheme.colorScheme.surface)) { Box(Modifier.fillMaxWidth().padding(8.dp)) {- Text(pack.first, Modifier.align(Alignment.Center), style = MaterialTheme.typography.displayMedium)+ Text(pack.name, Modifier.align(Alignment.Center), style = MaterialTheme.typography.displayMedium) } } }@@ -138,8 +137,7 @@ fun PackScreen(backStack: NavBackStack<Route>) { @OptIn(ExperimentalMaterial3Api::class) @Composable fun LevelScreen(backStack: NavBackStack<Route>, completedLevelsRepository: CompletedLevelsRepository, packIndex: Int) {- val packStartIndex = LevelData.PACKS.subList(0, packIndex).sumOf { it.second }- val packEndIndex = packStartIndex + LevelData.PACKS[packIndex].second+ val pack = LevelPack.PACKS[packIndex] val levelStats = completedLevelsRepository.getLevelStats() Scaffold(topBar = { TopAppBar({Text(stringResource(R.string.level_selector))})@@ -151,9 +149,9 @@ fun LevelScreen(backStack: NavBackStack<Route>, completedLevelsRepository: Compl verticalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp), ) {- itemsIndexed(LevelData.LEVELS.subList(packStartIndex, packEndIndex)) { index, levelData ->+ itemsIndexed(pack.levels) { index, levelData -> Card(Modifier.fillMaxWidth().aspectRatio(1f).clickable{- backStack.add(Route.Game(index))+ backStack.add(Route.Game(packIndex, index)) }, colors = CardDefaults.cardColors(MaterialTheme.colorScheme.surface)) { Box(Modifier.fillMaxSize().padding(8.dp)) { Text("${index + 1}", Modifier.align(Alignment.Center))@@ -174,15 +172,16 @@ fun LevelScreen(backStack: NavBackStack<Route>, completedLevelsRepository: Compl @OptIn(ExperimentalMaterial3Api::class) @Composable-fun GameScreen(backStack: NavBackStack<Route>, completedLevelsRepository: CompletedLevelsRepository, levelIndex: Int) {- var currentLevelData by remember { mutableStateOf(LevelData.LEVELS[levelIndex]) }+fun GameScreen(backStack: NavBackStack<Route>, completedLevelsRepository: CompletedLevelsRepository, packIndex: Int, levelIndex: Int) {+ val pack = LevelPack.PACKS[packIndex]+ var currentLevelData by remember { mutableStateOf(pack.levels[levelIndex]) } val history = remember { mutableStateListOf<LevelData>() } var isLevelWon by remember { mutableStateOf(false) } var levelStats by remember { mutableStateOf(completedLevelsRepository.getLevelStats()) } fun changeLevel(newLevelIndex: Int) {- val boundedIndex = newLevelIndex.coerceIn(0, LevelData.LEVELS.lastIndex)- backStack.setLast(Route.Game(boundedIndex))+ val boundedIndex = newLevelIndex.coerceIn(0, pack.levels.lastIndex)+ backStack.setLast(Route.Game(packIndex, boundedIndex)) } fun getCurrentMoves(): Int {@@ -223,7 +222,7 @@ fun GameScreen(backStack: NavBackStack<Route>, completedLevelsRepository: Comple levelIndex = levelIndex, onLevelChange = ::changeLevel, isCompleted = currentLevelStats != null,- maxLevelIndex = LevelData.LEVELS.lastIndex+ maxLevelIndex = pack.levels.lastIndex ) MovesInfoBox( moves = getCurrentMoves(),@@ -271,7 +270,7 @@ fun GameScreen(backStack: NavBackStack<Route>, completedLevelsRepository: Comple } Button(onClick = { history.clear()- currentLevelData = LevelData.LEVELS[levelIndex]+ currentLevelData = pack.levels[levelIndex] isLevelWon = false }, enabled = history.isNotEmpty() && !isLevelWon) {