Skip to content

Commit

Permalink
2A - Sticky Situation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysthaps committed Jan 4, 2024
1 parent 637093a commit 0e7ce2f
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 4 deletions.
Binary file added boards/Day_2A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/entities/Slime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/slimed/Ground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/slimed/slimed.ase
Binary file not shown.
2 changes: 2 additions & 0 deletions images/textureList
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@ count/Count_R.png
count/Count_G.png
count/Count_B.png
count/Ground_Eye.png
entities/Slime.png
slimed/Ground.png
2 changes: 1 addition & 1 deletion init.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ addOnLoadEvent(() => {
let startScript = "minesveeperMain.js";
// = = = = = = = = = = = = = = = = = = = = = = = = = =
// Load the day specific scripts
for(let i = 1; i <= 1; i++){
for(let i = 1; i <= 2; i++){
scriptList["day_" + i] = {
name : "days/day_" + i + ".js",
dependencies: ["days"],
Expand Down
2 changes: 2 additions & 0 deletions js/b64.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/days.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ var day61Fnct = null;
var day68Fnct = null;

(function(){
for(let i = 1; i <= 1; i++) days[i] = null;
for(let i = 101; i <= 101; i++) days[i] = null;
for(let i = 1; i <= 100; i++) days[i] = null;
for(let i = 101; i <= 200; i++) days[i] = null;

let smallDefault = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]];
let largeDefault = [
Expand Down
28 changes: 28 additions & 0 deletions js/days/day_2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
registerDay(2,
{
"title" : "Mystsveeper 2A - Sticky Situation",
"desc" : "A new entity has appeared! Enter the <b>Slime</b>, an adorable gooey creature that can and will ruin your life.<br><br>"
+ "She works almost like the Sheep, moves towards your cursor when you dig up a tile and can trigger mines.<br>"
+ "She will leave behind a trail of slime, which will stick onto tiles for <i>the rest of the game</i>.<br>"
+ "The slime trail will make tiles affected only see neighboring Red mines, ignoring Blue and Green mines.<br>"
+ "She also slips on her own trail, and she can <b>move toward your cursor while slipping</b>.<br><br>"
+ "Also, as usual with entities that move on dig, no chording.<br><br>"
+ "Obligatory Colorcharge Chart(tm):"
+ "<center><img src=\"desc/46_Colorcharge.png\" style=\"max-width:90%\"/></center><br>",
"mines" : {
"R" : 35,
"B" : 20,
"G" : 20,
},
"grayMines" : false,
"display" : "colorcharge",
"shape" : "default",
"decrementing" : false,
"x" : 25,
"y" : 25,
"disableChord" : true,
"spawn" : ["slime"],
"board" : "9MwNFxKjIMiwfot/v+51NAEXFMANAApFROgAIf/RkURcAowLIyK6Nh6jgFGhJFwOWvSpGAs6LNbmM+/zo",
});


21 changes: 21 additions & 0 deletions js/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,23 @@ let activeEntities = [];
}
};

let slimeAI = (e, i, j, ev) => {
if (ev != Entities.events.digOrChord) return;
board.at(e.x, e.y).effect = "slimed";
let dx = i - e.x;
let dy = j - e.y;
let t = basicMove(e, dx, dy);
if((t == null)) return;
if (t.open && t.effect == "slimed"){
slimeAI(e, i, j, ev);
return;
}
setFlag(e.x, e.y, "");
t.open = true;
if(t.surroundingMines.length != 0 || t.mine != "") return;
openSurrounding(e.x, e.y);
};

let placingCycle = 0;

Entities.clear = function(){
Expand Down Expand Up @@ -293,6 +310,10 @@ let activeEntities = [];
E.ai = projectileAI;
E.texture = Textures.entities.projectile[E.direction];
break;
case "slime":
E.texture = Textures.entities.slime;
E.ai = slimeAI;
break;
default:
console.log("Unknown Entity: " + name);
return;
Expand Down
1 change: 1 addition & 0 deletions js/makeTextures.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
for(let n in Textures.template.number){
Textures.background.number[n] = drawOnto(Textures.background.clear, Textures.template.number[n]);
Textures.background.numberGrayscale[n] = drawOntoRecolor(Textures.background.clearGrayscale, Textures.template.number[n], 0x68, 0x68, 0x68);
Textures.background.numberSlimed[n] = drawOntoRecolor(Textures.background.clearSlimed, Textures.template.number[n], 0x80, 0x00, 0x40)
}

const yx = -0.5;
Expand Down
23 changes: 23 additions & 0 deletions js/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ var renderModes = {
draw(Textures.invalid);
}
},
"slimed" : function(tile, draw){
let data = tile.surroundingMines.toLowerCase();
let number = 0;
let g = 0;
let b = 0;
for(let i of data){
if(i == "r") number++;
if(i == "g") g++;
if(i == "b") b++;
}
if(number == 0 && ((!activeSettings.decrementing) || (tile.surroundingFlags == "")) && (g == 0 && b == 0)){
draw(Textures.background.clearSlimed);
return;
}
if(activeSettings.decrementing) number -= tile.surroundingFlags.length;
if(number in Textures.background.numberSlimed){
draw(Textures.background.numberSlimed[number]);
}else{
draw(Textures.invalid);
}
},
"probability" : function(tile, draw){
let p = tile.probability;
if(p == 0){
Expand Down Expand Up @@ -147,6 +168,8 @@ var renderTileRunning = function(tile, count, draw){
draw(t);
}else if(tile.effect == "grayscale"){
renderModes["grayscale"](tile, draw);
}else if(tile.effect == "slimed"){
renderModes["slimed"](tile, draw);
}else{
let displayMode = activeSettings.display;
if(typeof(displayMode) == "string"){
Expand Down
3 changes: 3 additions & 0 deletions js/textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var Textures = {
explodedMine : {},
number : [],
numberGrayscale : [],
numberSlimed : [],
clearGrayscale : null,
numberColorcharge : [],
getColorCharge: null,
Expand Down Expand Up @@ -128,6 +129,7 @@ var Textures = {
return Textures.background.numberColorcharge[x][y];
};
Textures.background.clearGrayscale = loadTexture("grayscale/Ground.png", null);
Textures.background.clearSlimed = loadTexture("slimed/Ground.png", null)

Textures.entities.sheep = loadTexture("entities/Sheep.png", null);
Textures.entities.rat = loadTexture("entities/Rat.png", null);
Expand All @@ -139,6 +141,7 @@ var Textures = {
Textures.entities.projectile[1] = loadTexture("entities/Projectile_Down.png", null);
Textures.entities.projectile[2] = loadTexture("entities/Projectile_Left.png", null);
Textures.entities.projectile[3] = loadTexture("entities/Projectile_Up.png", null);
Textures.entities.slime = loadTexture("entities/Slime.png", null);

Textures.background.fractions.epsilon = loadTexture("numbers/num_epsilon.png", null);
Textures.background.fractions.frac_1_8 = loadTexture("numbers/num_frac_1_8.png", null);
Expand Down
2 changes: 1 addition & 1 deletion menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var addOnLoadEvent = null;
topBars[i]["object"] = document.getElementById(i);
}
let topBarContent = {};
for(s of ["home", "dd1", "dd2", "about"]){
for(s of ["home", "dd1", "about"]){
let tBarObj = document.getElementById("tbarcont-" + s);
topBarContent[s] = (tBarObj.classList.contains("dropdown") ? "<div class=\"dropdown\">" : "<div>") + tBarObj.innerHTML.replace(/[\t\n]/g,"") + "</div>";
}
Expand Down

0 comments on commit 0e7ce2f

Please sign in to comment.