Webpage for Games
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

function toTimeString(time, hoursWanted){
time = floor(time / 10);
let hs = String(floor(time % 100));
let fs = String(floor((time / 100) % 60));
if (hoursWanted){
let min = String(floor(((time / 100) / 60) % 60));
let hr = String(floor(((time / 100) / 60) / 60));
if (hs.length < 2) hs = "0" + hs;
if (fs.length < 2) fs = "0" + fs;
if (min.length < 2) min = "0" + min;
if (hr.length < 2) hr = "0" + hr;
return hr + ":" + min + ":" + fs + ":" + hs;
} else {
let min = String(floor(((time / 100) / 60) % 60));
if (hs.length < 2) hs = "0" + hs;
if (fs.length < 2) fs = "0" + fs;
if (min.length < 2) min = "0" + min;
return min + ":" + fs + ":" + hs;
}
}
function debugInformation(x, y){
push();
textSize(12);
textStyle(NORMAL);
stroke(255);
strokeWeight(1);
fill(255);
text("FPS : " + round(frameRate()), 10 + x, 10 + textAscent("FPS : ") + y);
text("MouseX : " + round(mouseX + x), 10 + x, 10 + textAscent("FPS : ") + 10 + textAscent("MouseX : ") + y);
text("MouseY : " + round(-mouseY - y), 10 + x, 10 + textAscent("FPS : ") + 10 + textAscent("MouseX : ") + 10 + textAscent("MouseY : ") + y);
pop();
}
function ranBool(chance){
if (!chance) chance = 2;
return Math.floor(Math.random() * chance + 1) === chance;
}
function ranBoolP(chancePercentage){
return chancePercentage > Math.random();
}