Testing Movement 3
New paths verses last iteration
by MegaScience
CSS
html,
body {
margin: 0;
height: 100%;
}
table {
max-width: 100%;
overflow-x: auto;
table-layout: fixed;
font-size: 1.5em;
}
tr {
color: white;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.Freddy {
color: brown;
}
.Bonnie {
color: blue;
}
.Chica {
color: yellow;
}
.Foxy {
color: red;
}
JavaScript
var movements = document.getElementById("Movements");
var elements = {};
setTimeout(function() {
var anim = simData.animatronics;
for(var i = 0, length = anim.length; i < length; i++) {
clearInterval(simData.animStats[anim[i]].timer);
}
console.log("Ended");
}, 60000);
function initialize() {
var table = document.createElement("table"),
tr, td;
simData.animatronics = [];
table.id = "Movements";
for(var anim in simData.animStats) {
if (!simData.animStats.hasOwnProperty(anim)) continue;
/*-------------------------------------*/
var curAnim = simData.animStats[anim],
level = (LocalDay < 6 ? curAnim.levels[LocalDay] : 20);
curAnim.timer = setInterval(move, curAnim.rate, anim);
curAnim.curLev = (level.constructor === Array ? level[Math.floor(Math.random() * level.length)] : level);
simData.animatronics.push(anim);
/*-------------------------------------*/
tr = document.createElement("tr");
elements[anim] = tr;
td = document.createElement("td");
td.innerHTML = tr.className = anim;
tr.appendChild(td);
td = document.createElement("td");
td.innerHTML = curAnim.loc;
tr.appendChild(td);
table.appendChild(tr);
}
document.body.appendChild(table);
}
//
// /(?=.*C)(?=.*F)(?=.*B)/.test("FBC");
var animatronicData = function(abbr, behavior, rate, levels, loc, pattern, viewLock, stage, mStage) {
this.abbr = (typeof abbr !== 'undefined' ? abbr : defAnim.abbr);
this.behavior = (typeof behavior !== 'undefined' ? behavior : defAnim.behavior);
this.rate = (typeof rate !== 'undefined' ? rate : defAnim.rate);
this.levels = (typeof levels !== 'undefined' ? levels : defAnim.levels);
this.loc = (typeof loc !== 'undefined' ? loc : defAnim.loc);
this.pattern = (typeof pattern !== 'undefined' ? pattern : defAnim.pattern);
this.stage = (typeof stage !== 'undefined' ? stage : defAnim.stage);
this.mStage = (typeof mStage !== 'undefined' ? mStage : defAnim.mStage);
this.viewLock = (typeof viewLock !== 'undefined' ? viewLock :...