udatinos/river.js
2021-04-04 12:59:48 +02:00

71 line
1.3 KiB
JavaScript

function River(){
this._timer;
this._bg;
this._gui;
this._checks;
this._poi;
this.enter = function()
{
this._timer=millis();
this._bg = loadImage('oreto_restyle_1720x520.png');
//background("#b86af0");
console.log("ENTER RIVER")
}
this.setup = function() {
createCanvas(_w, _h);
this._gui = createGui();
this._checks=[]
for (let step = 0; step < pois.length; step++) {
this._checks.push(createCheckbox("Checkbox"+step, 50, 50 + (step*20),10,10,true));
}
}
this.draw = function() {
if(millis()-this._timer > 20000){
_mgr.showScene( Screensaver );
}
background(this._bg);
drawGui();
for (let step = 0; step < pois.length; step++) {
cb = this._checks[step];
if(cb.val){
fill(255)
//getPin(trx1,try1);
pois[step].adapt();
pois[step].pin();
}
}
if (mouseIsPressed) {
fill(0);
resetTimer();
}
}
this.mouseClicked = function(){
for (let step = 0; step < pois.length; step++) {
if(pois[step].overMe()){
$jq("#poi_"+step).modal();
console.log("Clicked on: " + poi.id);
}
}
}
function resetTimer(){
console.log("Timer: " + this._timer)
this._timer=millis()
console.log("Timer: " + this._timer + " millis: " + millis())
}
}