river.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. function River(){
  2. this._timer;
  3. this._bg;
  4. this._gui;
  5. this._checks;
  6. this._poi;
  7. this.enter = function()
  8. {
  9. this._timer=millis();
  10. this._bg = loadImage('oreto_restyle_1720x520.png');
  11. //background("#b86af0");
  12. console.log("ENTER RIVER")
  13. }
  14. this.setup = function() {
  15. createCanvas(_w, _h);
  16. this._gui = createGui();
  17. this._checks=[]
  18. for (let step = 0; step < pois.length; step++) {
  19. this._checks.push(createCheckbox("Checkbox"+step, 50, 50 + (step*20),10,10,true));
  20. }
  21. }
  22. this.draw = function() {
  23. if(millis()-this._timer > 20000){
  24. _mgr.showScene( Screensaver );
  25. }
  26. background(this._bg);
  27. drawGui();
  28. for (let step = 0; step < pois.length; step++) {
  29. cb = this._checks[step];
  30. if(cb.val){
  31. fill(255)
  32. //getPin(trx1,try1);
  33. pois[step].adapt();
  34. pois[step].pin();
  35. }
  36. }
  37. if (mouseIsPressed) {
  38. fill(0);
  39. resetTimer();
  40. }
  41. }
  42. this.mouseClicked = function(){
  43. for (let step = 0; step < pois.length; step++) {
  44. if(pois[step].overMe()){
  45. console.log("Clicked on: " + poi.id);
  46. }
  47. }
  48. }
  49. function resetTimer(){
  50. console.log("Timer: " + this._timer)
  51. this._timer=millis()
  52. console.log("Timer: " + this._timer + " millis: " + millis())
  53. }
  54. }