|
|
Line 128: |
Line 128: |
| bgReady = true; | | bgReady = true; |
| }; | | }; |
− | bgImage.src = "plattegrondGelijksvloer.PNG"; | + | bgImage.src = "https://static.igem.org/mediawiki/2015/7/7b/KU_Leuven_PlattegrondGelijksvloer.png"; |
| | | |
| | | |
Line 153: |
Line 153: |
| doorReady = true; | | doorReady = true; |
| }; | | }; |
− | doorImage.src = "magicdoor.png"; | + | doorImage.src = "https://static.igem.org/mediawiki/2015/2/25/KU_Leuven_Magicdoor.png"; |
| var windowfound = 0; | | var windowfound = 0; |
| | | |
Line 193: |
Line 193: |
| if (level < 1) { | | if (level < 1) { |
| if (38 in keysDown) { // Player holding up | | if (38 in keysDown) { // Player holding up |
− | if (avatar.y < 210 && avatar.y > 160) { | + | if (avatar.y < 210 ){ if (avatar.y > 160) { |
| if (avatar.x > 370){ | | if (avatar.x > 370){ |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
Line 202: |
Line 202: |
| else if (avatar.x > 130 && avatar.x < 150){ | | else if (avatar.x > 130 && avatar.x < 150){ |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
− | } | + | } } |
| } | | } |
− | else if (avatar.y < 280 && avatar.y > 260){ | + | else if (avatar.y < 280 ) { if (avatar.y > 260){ |
| if (avatar.x > 370){ | | if (avatar.x > 370){ |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
Line 210: |
Line 210: |
| else if (avatar.x > 280 && avatar.x < 360){ | | else if (avatar.x > 280 && avatar.x < 360){ |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
− | } | + | } } |
| else if (avatar.x < 160){ | | else if (avatar.x < 160){ |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
| } | | } |
| } | | } |
− | else if (avatar.y < 72 && avatar.y > 140){ | + | else if (avatar.y < 72 ){ if (avatar.y > 140){ |
| if (avatar.x > 365){ | | if (avatar.x > 365){ |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
Line 222: |
Line 222: |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
| } | | } |
− | } | + | }} |
| else { | | else { |
| avatar.y -= avatar.speed * modifier; | | avatar.y -= avatar.speed * modifier; |
Line 228: |
Line 228: |
| } | | } |
| if (40 in keysDown) { // Player holding down | | if (40 in keysDown) { // Player holding down |
− | if (avatar.y < 160 && avatar.y > 150) { | + | if (avatar.y < 160 ){ if (avatar.y > 150) { |
| if (avatar.x > 370){ | | if (avatar.x > 370){ |
| avatar.y += avatar.speed * modifier; | | avatar.y += avatar.speed * modifier; |
Line 238: |
Line 238: |
| avatar.y += avatar.speed * modifier; | | avatar.y += avatar.speed * modifier; |
| } | | } |
− | } | + | }} |
− | else if (avatar.y < 260 && avatar.y > 210){ | + | else if (avatar.y < 260 ){if( avatar.y > 210){ |
| if (avatar.x > 370){ | | if (avatar.x > 370){ |
| avatar.y += avatar.speed * modifier; | | avatar.y += avatar.speed * modifier; |
Line 252: |
Line 252: |
| avatar.y += avatar.speed * modifier; | | avatar.y += avatar.speed * modifier; |
| } | | } |
− | } | + | }} |
− | else if (avatar.y < 108 && avatar.y > 95){ | + | else if (avatar.y < 108 ){ if (avatar.y > 95){ |
| if (avatar.x > 370){ | | if (avatar.x > 370){ |
| avatar.y += avatar.speed * modifier; | | avatar.y += avatar.speed * modifier; |
Line 260: |
Line 260: |
| avatar.y += avatar.speed * modifier; | | avatar.y += avatar.speed * modifier; |
| } | | } |
− | } | + | }} |
| else { | | else { |
| avatar.y += avatar.speed * modifier; | | avatar.y += avatar.speed * modifier; |
Line 270: |
Line 270: |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
| } | | } |
− | else if (avatar.x > 210 && avatar.x < 350){ | + | else if (avatar.x > 210){ if (avatar.x < 350){ |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
− | } | + | }} |
| else if (avatar.x < 200){ | | else if (avatar.x < 200){ |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
Line 289: |
Line 289: |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
| } | | } |
− | else if (avatar.x > 210 && avatar.x < 350){ | + | else if (avatar.x > 210){ if (avatar.x < 350){ |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
| } | | } |
Line 318: |
Line 318: |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
| } | | } |
− | else if (avatar.x > 210 && avatar.x < 350){ | + | else if (avatar.x > 210){if (avatar.x < 350){ |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
− | } | + | }} |
− | else if (avatar.x > 130 && avatar.x < 190){ | + | else if (avatar.x > 130){ if (avatar.x < 190){ |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
− | } | + | }} |
| else if (avatar.x < 120){ | | else if (avatar.x < 120){ |
| avatar.x -= avatar.speed * modifier; | | avatar.x -= avatar.speed * modifier; |
Line 333: |
Line 333: |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
| } | | } |
− | else if (avatar.x > 160 && avatar.x < 315){ | + | else if (avatar.x > 160){ if (avatar.x < 315){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
− | } | + | }} |
| else if (avatar.x < 150){ | | else if (avatar.x < 150){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
Line 352: |
Line 352: |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
| } | | } |
− | else if (avatar.x > 200 && avatar.x < 312){ | + | else if (avatar.x > 200){ if (avatar.x < 312){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
− | } | + | }} |
− | else if (avatar.x > 150 && avatar.x < 190){ | + | else if (avatar.x > 150){ if (avatar.x < 190){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
− | } | + | }} |
| else if (avatar.x < 145){ | | else if (avatar.x < 145){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
Line 384: |
Line 384: |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
| } | | } |
− | else if (avatar.x > 160 && avatar.x < 312){ | + | else if (avatar.x > 160){ if (avatar.x < 312){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
− | } | + | }} |
− | else if (avatar.x > 110 && avatar.x < 150){ | + | else if (avatar.x > 110){ if (avatar.x < 150){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
− | } | + | }} |
| else if (avatar.x < 70){ | | else if (avatar.x < 70){ |
| avatar.x += avatar.speed * modifier; | | avatar.x += avatar.speed * modifier; |
Line 454: |
Line 454: |
| } | | } |
| else { | | else { |
− | bgImage.src = "Firstfloor.png"; | + | bgImage.src = "https://static.igem.org/mediawiki/2015/f/f6/KU_Leuven_Firstfloor.png"; |
| level=1; | | level=1; |
| leveldiscovered=0; | | leveldiscovered=0; |
Line 484: |
Line 484: |
| } | | } |
| //toilet | | //toilet |
− | else if (avatar.x > 80 && avatar.y > 270) { | + | else if (avatar.x > 80){ if (avatar.y > 270) { |
| document.getElementById("general").style.display = "none"; | | document.getElementById("general").style.display = "none"; |
| document.getElementById("outreach").style.display = "none"; | | document.getElementById("outreach").style.display = "none"; |
Line 492: |
Line 492: |
| document.getElementById("modeling").style.display = "none"; | | document.getElementById("modeling").style.display = "none"; |
| document.getElementById("research").style.display = "none"; | | document.getElementById("research").style.display = "none"; |
− | } | + | }} |
| } | | } |
| | | |
Line 526: |
Line 526: |
| | | |
| else if (avatar.y > canvas.height-65){ | | else if (avatar.y > canvas.height-65){ |
− | if (avatar.x > 290 && avatar.x < 320){ | + | if (avatar.x > 290){ if (avatar.x < 320){ |
| avatar.y=0; | | avatar.y=0; |
| level = 3; | | level = 3; |
− | } | + | }} |
| else { | | else { |
| avatar.y=canvas.height-65; | | avatar.y=canvas.height-65; |
| } | | } |
| } | | } |
− |
| |
− | }
| |
− |
| |
− | //eerste verdieping
| |
− | else if (level < 2) {
| |
− | if (38 in keysDown) { // Player holding up
| |
− | if (avatar.y < 210 && avatar.y > 160) {
| |
− | if (avatar.x > 210 && avatar.x < 310){
| |
− | avatar.y -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 150 && avatar.y > 120) {
| |
− | if (avatar.x < 160) {
| |
− | avatar.y -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 370) {
| |
− | avatar.y -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else {
| |
− | avatar.y -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | if (40 in keysDown) { // Player holding down
| |
− | if (avatar.y < 180 && avatar.y > 150) {
| |
− | if (avatar.x > 210 && avatar.x < 310){
| |
− | avatar.y += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y > canvas.height-110) {
| |
− | if (avatar.x > 210){
| |
− | avatar.y += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 120 && avatar.y > 90) {
| |
− | if (avatar.x < 160) {
| |
− | avatar.y += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 370) {
| |
− | avatar.y += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else {
| |
− | avatar.y += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | if (37 in keysDown) { // Player holding left
| |
− | if (avatar.y < 70) {
| |
− | if (avatar.x > 375){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 215 && avatar.x < 350){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x < 200){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 95) {
| |
− | if (avatar.x > 215){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x < 200){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 145) {
| |
− | if (avatar.x < 215 ) {
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 375) {
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 155) {
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.y <205) {
| |
− | if (avatar.x < 375 && avatar.x > 215){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 210) {
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.y >215) {
| |
− | if (avatar.x > 375){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 215 && avatar.x < 350){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x < 200){
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | }
| |
− | if (39 in keysDown) { // Player holding right
| |
− | if (avatar.y < 70) {
| |
− | if (avatar.x > 350){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 180 && avatar.x < 310){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x < 155){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 95) {
| |
− | if (avatar.x > 210){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x < 155){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 145) {
| |
− | if (avatar.x < 155 ) {
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 350) {
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 155) {
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.y <205) {
| |
− | if (avatar.x < 310 && avatar.x > 155){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | else if (avatar.y < 210) {
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.y >215) {
| |
− | if (avatar.x > 350){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x > 180 && avatar.x < 310){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | else if (avatar.x < 150){
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | // walls
| |
− | if (avatar.x < 30){
| |
− | avatar.x=30;
| |
− | if (avatar.y < 20){
| |
− | avatar.y=20;
| |
− | }
| |
− | if (avatar.y > canvas.height-72){
| |
− | avatar.y=canvas.height-72;
| |
− | }
| |
− | }
| |
− |
| |
− | else if (avatar.y < 20){
| |
− | avatar.y=20;
| |
− | if (avatar.x > canvas.width-70){
| |
− | avatar.x=canvas.width-70;
| |
− | }
| |
− | }
| |
− |
| |
− | else if (avatar.x > canvas.width-70){
| |
− | avatar.x=canvas.width-70;
| |
− | if (avatar.y > canvas.height-70){
| |
− | avatar.y=canvas.height-70;
| |
− | }
| |
− | }
| |
− |
| |
− |
| |
− | else if (avatar.y > canvas.height-70){
| |
− | avatar.y=canvas.height-70;
| |
− | }
| |
− |
| |
− |
| |
− |
| |
− | else if (avatar.y > canvas.height-50){
| |
− | avatar.y=canvas.height-50;
| |
− | }
| |
− |
| |
− | //checken in welke kamer je bent en de correcte tekst vertonen
| |
− | if (avatar.x > 320) {
| |
− | //living
| |
− | if (avatar.y > 200){
| |
− | document.getElementById("general").style.display = "none";
| |
− | document.getElementById("outreach").style.display = "none";
| |
− | document.getElementById("team").style.display = "block";
| |
− | document.getElementById("project").style.display = "none";
| |
− | document.getElementById("notebook").style.display = "none";
| |
− | document.getElementById("modeling").style.display = "none";
| |
− | document.getElementById("research").style.display = "none";
| |
− | }
| |
− | //eettafel
| |
− | else {
| |
− | document.getElementById("general").style.display = "none";
| |
− | document.getElementById("outreach").style.display = "none";
| |
− | document.getElementById("team").style.display = "none";
| |
− | document.getElementById("project").style.display = "block";
| |
− | document.getElementById("notebook").style.display = "none";
| |
− | document.getElementById("modeling").style.display = "none";
| |
− | document.getElementById("research").style.display = "none";
| |
− | }
| |
− | }
| |
− |
| |
− | else if (avatar.x > 160) {
| |
− | //keuken
| |
− | if (avatar.y < 205){
| |
− | document.getElementById("general").style.display = "none";
| |
− | document.getElementById("outreach").style.display = "block";
| |
− | document.getElementById("team").style.display = "none";
| |
− | document.getElementById("project").style.display = "none";
| |
− | document.getElementById("notebook").style.display = "none";
| |
− | document.getElementById("modeling").style.display = "none";
| |
− | document.getElementById("research").style.display = "none";
| |
− | }
| |
− | else if (avatar.y >270) {
| |
− | //inkom
| |
− | if (avatar.x > 240){
| |
− | document.getElementById("general").style.display = "block";
| |
− | document.getElementById("outreach").style.display = "none";
| |
− | document.getElementById("team").style.display = "none";
| |
− | document.getElementById("project").style.display = "none";
| |
− | document.getElementById("notebook").style.display = "none";
| |
− | document.getElementById("modeling").style.display = "none";
| |
− | document.getElementById("research").style.display = "none";
| |
− | leveldiscovered=1;
| |
− | }
| |
− | //trap
| |
− | else {
| |
− | if (leveldiscovered < 1) {
| |
− | document.getElementById("general").style.display = "block";
| |
− | document.getElementById("outreach").style.display = "none";
| |
− | document.getElementById("team").style.display = "none";
| |
− | document.getElementById("project").style.display = "none";
| |
− | document.getElementById("notebook").style.display = "none";
| |
− | document.getElementById("modeling").style.display = "none";
| |
− | document.getElementById("research").style.display = "none";
| |
− | }
| |
− | else {
| |
− | bgImage.src = "plattegrondGelijksvloer.PNG";
| |
− | level=0;
| |
− | leveldiscovered=0;
| |
− | }
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | else if (avatar.x < 150) {
| |
− | //bureau
| |
− | if (avatar.y < 205){
| |
− | document.getElementById("general").style.display = "none";
| |
− | document.getElementById("outreach").style.display = "none";
| |
− | document.getElementById("team").style.display = "none";
| |
− | document.getElementById("project").style.display = "none";
| |
− | document.getElementById("notebook").style.display = "none";
| |
− | document.getElementById("modeling").style.display = "block";
| |
− | document.getElementById("research").style.display = "none";
| |
− | }
| |
− | //badkamer
| |
− | else if (avatar.x < 80) {
| |
− | document.getElementById("general").style.display = "none";
| |
− | document.getElementById("outreach").style.display = "none";
| |
− | document.getElementById("team").style.display = "none";
| |
− | document.getElementById("project").style.display = "none";
| |
− | document.getElementById("notebook").style.display = "none";
| |
− | document.getElementById("modeling").style.display = "none";
| |
− | document.getElementById("research").style.display = "block";
| |
− | }
| |
− | //toilet
| |
− | else if (avatar.x > 80 && avatar.y > 270) {
| |
− | document.getElementById("general").style.display = "none";
| |
− | document.getElementById("outreach").style.display = "none";
| |
− | document.getElementById("team").style.display = "none";
| |
− | document.getElementById("project").style.display = "none";
| |
− | document.getElementById("notebook").style.display = "block";
| |
− | document.getElementById("modeling").style.display = "none";
| |
− | document.getElementById("research").style.display = "none";
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | //tuin
| |
− | else {
| |
− | flowerImage.src = "Bloemen35.gif";
| |
− | bgImage.src = "gras.jpg";
| |
− |
| |
− | if (38 in keysDown) {
| |
− | avatar.y -= avatar.speed * modifier;
| |
− | }
| |
− | if (40 in keysDown) {
| |
− | avatar.y += avatar.speed * modifier;
| |
− | }
| |
− | if (37 in keysDown) {
| |
− | avatar.x -= avatar.speed * modifier;
| |
− | }
| |
− | if (39 in keysDown) {
| |
− | avatar.x += avatar.speed * modifier;
| |
− | }
| |
− | if (avatar.x <= (flower.x + 32)){
| |
− | if(flower.x <= (avatar.x + 32)){
| |
− | if(avatar.y <= (flower.y + 32)){
| |
− | if(flower.y <= (avatar.y + 32)){
| |
− | ++flowersCaught;
| |
− | avatar.speed=avatar.speed+2;
| |
− | start=start+1;
| |
− | reset();
| |
− | }
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | if (flowersCaught > 0) {
| |
− | if (avatar.x < 380){
| |
− | if( avatar.x > 285){
| |
− | if(avatar.y > 285){
| |
− | if( avatar.y < 370){
| |
− | if (windowfound < 1) {
| |
− | window.alert("you can visit our secret page")
| |
− | windowfound = 1;
| |
− | reset();
| |
− | }
| |
− | }
| |
− | }
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | if (avatar.x < 0){
| |
− | avatar.x=canvas.width;
| |
− | if (avatar.y < 0){
| |
− | avatar.y=canvas.height;
| |
− | }
| |
− | if (avatar.y > canvas.height){
| |
− | avatar.y=0;
| |
− | }
| |
− | }
| |
− |
| |
− | else if (avatar.y > canvas.height){
| |
− | avatar.y=0;
| |
− | if (avatar.x > canvas.width){
| |
− | avatar.x=0;
| |
− | }
| |
− | }
| |
− |
| |
− | else if (avatar.x > canvas.width){
| |
− | avatar.x=0;
| |
− | if (avatar.y > canvas.height){
| |
− | avatar.y=0;
| |
− | }
| |
− | }
| |
− |
| |
− | else if (avatar.y < 0){
| |
− | if (avatar.x > 290 && avatar.x < 320){
| |
− | avatar.y = canvas.height-65;
| |
− | level = 0;
| |
− | bgImage.src = "plattegrondGelijksvloer.PNG";
| |
− | }
| |
− | else {
| |
− | avatar.y=canvas.height;
| |
− | }
| |
− | }
| |
− |
| |
| | | |
| } | | } |