(47 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
<!--- Own CSS ---> | <!--- Own CSS ---> | ||
<link rel="stylesheet" href="https://2018.igem.org/Template:HebrewU/CSS?action=raw&ctype=text/css"> | <link rel="stylesheet" href="https://2018.igem.org/Template:HebrewU/CSS?action=raw&ctype=text/css"> | ||
− | |||
− | |||
− | |||
<!--- Main Menu script ---> | <!--- Main Menu script ---> | ||
Line 16: | Line 13: | ||
<!--- w3 Css ---> | <!--- w3 Css ---> | ||
<link rel="stylesheet" href="https://2018.igem.org/Template:HebrewU/w3?action=raw&ctype=text/css"> | <link rel="stylesheet" href="https://2018.igem.org/Template:HebrewU/w3?action=raw&ctype=text/css"> | ||
+ | |||
<style> | <style> | ||
Line 36: | Line 34: | ||
− | |||
− | |||
− | |||
@media (max-width: 1000px) { | @media (max-width: 1000px) { | ||
Line 85: | Line 80: | ||
.ulogo { display:none; } | .ulogo { display:none; } | ||
+ | |||
+ | #myDIV button{ | ||
+ | display:none; | ||
+ | } | ||
+ | |||
} | } | ||
Line 95: | Line 95: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
@keyframes flash { | @keyframes flash { | ||
Line 148: | Line 124: | ||
padding-left:10%; | padding-left:10%; | ||
text-align:center; | text-align:center; | ||
+ | } | ||
+ | |||
+ | .start_button { | ||
+ | display:block; | ||
+ | |||
+ | } | ||
+ | |||
+ | canvas { | ||
+ | display:none; | ||
+ | border: solid 1px black; | ||
+ | position:relative; | ||
+ | margin: 0 auto 0 auto; | ||
+ | } | ||
+ | |||
+ | .index_body { | ||
+ | width: 80%; | ||
+ | color: black; | ||
+ | Padding-left: 10%; | ||
+ | Padding-right: 10%; | ||
+ | Padding-top: 3%; | ||
+ | } | ||
+ | |||
+ | .ahuji { | ||
+ | color: white; | ||
+ | } | ||
+ | |||
+ | .index_body { | ||
+ | color: white; | ||
+ | |||
+ | } | ||
+ | |||
+ | #HQ_page p { | ||
+ | color:white; | ||
+ | |||
+ | } | ||
+ | |||
+ | #myDIV button{ | ||
+ | background-color:black; | ||
+ | padding:0px; | ||
+ | } | ||
+ | |||
+ | a:visited { | ||
+ | color: yellow; | ||
} | } | ||
Line 154: | Line 173: | ||
<body> | <body> | ||
+ | <div class="w3-blue-gray"> | ||
<ul id="ddmenu_hebrewu"> | <ul id="ddmenu_hebrewu"> | ||
Line 173: | Line 193: | ||
<li><a href="https://2018.igem.org/Team:HebrewU/Description">Description</a></li> | <li><a href="https://2018.igem.org/Team:HebrewU/Description">Description</a></li> | ||
<li><a href="https://2018.igem.org/Team:HebrewU/Model">Model</a></li> | <li><a href="https://2018.igem.org/Team:HebrewU/Model">Model</a></li> | ||
− | <li><a href="https://2018.igem.org/Team:HebrewU/ | + | <li><a href="https://2018.igem.org/Team:HebrewU/Demonstrate">Results</a></li> |
<li><a href="https://2018.igem.org/Team:HebrewU/Parts">Parts</a></li> | <li><a href="https://2018.igem.org/Team:HebrewU/Parts">Parts</a></li> | ||
− | <li><a href="https://2018.igem.org/Team:HebrewU/ | + | <li><a href="https://2018.igem.org/Team:HebrewU/Software">MOOLTi</a></li> |
</ul> | </ul> | ||
Line 205: | Line 225: | ||
<ul> | <ul> | ||
<li><a href="https://2018.igem.org/Team:HebrewU/Team">Members</a></li> | <li><a href="https://2018.igem.org/Team:HebrewU/Team">Members</a></li> | ||
− | <li><a href="https://2018.igem.org/Team:HebrewU/ | + | <li><a href="https://2018.igem.org/Team:HebrewU/Attributions">Attributions</a></li> |
<li><a href="https://2018.igem.org/Team:HebrewU/Collaborations">Collaborations</a></li> | <li><a href="https://2018.igem.org/Team:HebrewU/Collaborations">Collaborations</a></li> | ||
<li><a href="https://2018.igem.org/Team:HebrewU/Photo_Gallery">Photo Gallery</a></li> | <li><a href="https://2018.igem.org/Team:HebrewU/Photo_Gallery">Photo Gallery</a></li> | ||
Line 228: | Line 248: | ||
<a href="https://2018.igem.org/Team:HebrewU/Description"><button class="b_huji_small_subnav">Description</button></a> | <a href="https://2018.igem.org/Team:HebrewU/Description"><button class="b_huji_small_subnav">Description</button></a> | ||
<a href="https://2018.igem.org/Team:HebrewU/Model"><button class="b_huji_small_subnav">Model</button></a> | <a href="https://2018.igem.org/Team:HebrewU/Model"><button class="b_huji_small_subnav">Model</button></a> | ||
− | <a href="https://2018.igem.org/Team:HebrewU/ | + | <a href="https://2018.igem.org/Team:HebrewU/Demonstrate"><button class="b_huji_small_subnav">Results</button></a> |
<a href="https://2018.igem.org/Team:HebrewU/Parts"><button class="b_huji_small_subnav">Parts</button></a> | <a href="https://2018.igem.org/Team:HebrewU/Parts"><button class="b_huji_small_subnav">Parts</button></a> | ||
− | <a href="https://2018.igem.org/Team:HebrewU/Software"><button class="b_huji_small_subnav"> | + | <a href="https://2018.igem.org/Team:HebrewU/Software"><button class="b_huji_small_subnav">MOOLTi</button></a> |
</div> | </div> | ||
Line 257: | Line 277: | ||
<button class="huji_small_navbar">Team</button> | <button class="huji_small_navbar">Team</button> | ||
<div class="huji_small_navbar_panel"> | <div class="huji_small_navbar_panel"> | ||
− | <a href="https://2018.igem.org/Team:HebrewU/ | + | <a href="https://2018.igem.org/Team:HebrewU/Team"><button class="b_huji_small_subnav">Members</button></a> |
<a href="https://2018.igem.org/Team:HebrewU/Attributionsn"><button class="b_huji_small_subnav">Attributions</button></a> | <a href="https://2018.igem.org/Team:HebrewU/Attributionsn"><button class="b_huji_small_subnav">Attributions</button></a> | ||
<a href="https://2018.igem.org/Team:HebrewU/Collaborations"><button class="b_huji_small_subnav">Collaborations</button></a> | <a href="https://2018.igem.org/Team:HebrewU/Collaborations"><button class="b_huji_small_subnav">Collaborations</button></a> | ||
Line 295: | Line 315: | ||
</script> | </script> | ||
+ | <a onClick="topFunction()" id="myBtn_up" title="Go to top"><img src="https://static.igem.org/mediawiki/2018/1/1e/T--hebrewu--arrow_up.png" width="40px" /></a> | ||
+ | |||
+ | <script> | ||
+ | // When the user scrolls down 20px from the top of the document, show the button | ||
+ | window.onscroll = function() {scrollFunction()}; | ||
+ | |||
+ | function scrollFunction() { | ||
+ | if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { | ||
+ | document.getElementById("myBtn_up").style.display = "block"; | ||
+ | } else { | ||
+ | document.getElementById("myBtn_up").style.display = "none"; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // When the user clicks on the button, scroll to the top of the document | ||
+ | function topFunction() { | ||
+ | document.body.scrollTop = 0; | ||
+ | document.documentElement.scrollTop = 0; | ||
+ | } | ||
+ | </script> | ||
<div class="huji_container"> | <div class="huji_container"> | ||
− | <img src="https://static.igem.org/mediawiki/2018/ | + | <img src="https://static.igem.org/mediawiki/2018/a/a2/T--hebrewu--final_index_pic.png" alt="Snow" style="width:100%;"> |
− | <div class="centered" | + | <div class="centered"></div> |
</div> | </div> | ||
− | <!--- | + | |
− | <div class=" | + | <!------------ Awards modal start -------------> |
− | <a href=" | + | <div id="huji_jamb" class="w3-modal" style="display:inline-block"> |
− | </div> | + | <div class="w3-modal-content w3-animate-zoom"> |
+ | <header class="w3-container w3-dark-gray"> | ||
+ | <span onClick="document.getElementById('huji_jamb').style.display='none'" | ||
+ | class="w3-button w3-display-topright">×</span> | ||
+ | <h2 align="center" style="color:white"><b> ~ Giant Jamboree 2018 Results ~ </b></h2> | ||
+ | </header> | ||
+ | <div class="w3-container w3-blue-gray"> | ||
+ | <div style="text-align:center"> | ||
+ | <p style="color:white; font-size:24px;text-align:justify; padding-left:50px;"> <br /> | ||
+ | Hello everyone, <br /> | ||
+ | We are glad to share with you our results from the iGEM conference:<br /><br /> </p> | ||
+ | <p style="color:white; font-size:24px;text-align:justify;padding-left:100px;"> | ||
+ | <b> Best Plant Synthetic Biology </b> <br /> | ||
+ | Second place in the Environmental Research category<br /> | ||
+ | Nominated for the Best Software Tool<br /> | ||
+ | Gold Medal for our overall project achievements<br /><br /> | ||
+ | </p> | ||
+ | <div style="text-align:center"> | ||
+ | <img src="https://static.igem.org/mediawiki/2018/b/b0/T--HebrewU--Bestplant.jpeg" width="75%"> <br /> | ||
+ | <img src="https://static.igem.org/mediawiki/2018/c/cb/T--HebrewU--Jamboree2018_1.jpeg" width="75%"><br /> | ||
+ | </div> <br /> | ||
+ | |||
+ | |||
+ | <p style="color:white; font-size:24px;text-align:justify; padding-left:50px;"> <br /> | ||
+ | We would like to thank again for all of our <a href="https://2018.igem.org/Team:HebrewU/Attributions">supporters</a>, who helped us make it all possible. Toda Raba! <br /> <br /> | ||
+ | </p> | ||
+ | <h2 style="color:white"> HebrewU i-GEM Team 2018 </h2> <br /> | ||
+ | |||
+ | <p style="color:white; font-size:30px;text-align:center;"> <br /> | ||
+ | </p> | ||
+ | </div> | ||
+ | |||
+ | <footer class="w3-container"> | ||
+ | <p> </p> | ||
+ | </footer> | ||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | </div> | ||
+ | <!------------ Awards modal end -------------> | ||
<!--- Page content start ---> | <!--- Page content start ---> | ||
− | <div class=" | + | |
− | + | <div class="index_body"> | |
− | + | ||
− | + | ||
− | + | ||
Line 324: | Line 401: | ||
<div class="w3-third"> | <div class="w3-third"> | ||
− | <button class="ripple"><img src="https://static.igem.org/mediawiki/2018/3/3c/T--Hebrewu--highlight_OS.png" width="150px" height="150px"></button> | + | <a href="https://2018.igem.org/Team:HebrewU/Open_Source"><button class="ripple"><img src="https://static.igem.org/mediawiki/2018/3/3c/T--Hebrewu--highlight_OS.png" width="150px" height="150px"></button> </a> |
− | <p style="text-align:justify"> We | + | <p style="text-align:justify"> We designed an open source platform where researchers anywhere can view our synthetic pathway and |
+ | conduct their own research, inserting it into native plants and building upon our database.</p> | ||
</div> | </div> | ||
<div class="w3-third"> | <div class="w3-third"> | ||
− | <button class="ripple"><img src="https://static.igem.org/mediawiki/2018/c/c0/T--Hebrewu--highlight_Moolti.png" width="150px" height="150px"></button> | + | <a href="https://2018.igem.org/Team:HebrewU/Software"><button class="ripple"><img src="https://static.igem.org/mediawiki/2018/c/c0/T--Hebrewu--highlight_Moolti.png" width="150px" height="150px"></button></a> |
− | <p style="text-align:justify;padding-left:10%;width:80%;">Our <b>M</b>ultiple <b>O</b>rganism <b>O</b>ptimization <b>L</b>ab <b>T</b>ool for <b>i</b>GEM | + | <p style="text-align:justify;padding-left:10%;width:80%;">Our <b>M</b>ultiple <b>O</b>rganism <b>O</b>ptimization <b>L</b>ab <b>T</b>ool for <b>i</b>GEM allows biologists to optimize codon usage for |
+ | multiple organisms simultaneously. | ||
</p> | </p> | ||
Line 339: | Line 418: | ||
<div class="w3-third"> | <div class="w3-third"> | ||
− | + | <a href="https://2018.igem.org/Team:HebrewU/Model"> <button class="ripple"><img src="https://static.igem.org/mediawiki/2018/f/f3/T--hebrewu--model_icon_new.png" width="150px" height="150px"></button> </a> | |
− | <p style="text-align:justify">We created | + | <p style="text-align:justify">We have created a model enzymatic pathway for dioxin and chlorinated-compound degradation, which |
+ | serves as the foundation of our research and project design. </p> | ||
</div> | </div> | ||
</div> | </div> | ||
</div> | </div> | ||
− | |||
<div> | <div> | ||
+ | |||
+ | |||
+ | <!--- Abstract ---> | ||
+ | <div class="w3-center"> | ||
+ | <img src="https://static.igem.org/mediawiki/2018/a/ac/T--Hebrewu--plant_index.png" width="80%"> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | </div> | ||
+ | |||
+ | |||
<!-- Second Grid --> | <!-- Second Grid --> | ||
− | < | + | <canvas style="text-align:center" id="canvas" width="800" height="600" tabindex='2'></canvas> |
− | <div | + | <div > |
− | < | + | <div class='box_container' id="TC" style="float:right;"> |
− | + | ||
</div> | </div> | ||
</div> | </div> | ||
+ | <div id="myDIV" style="text-align:center;"> | ||
+ | <button class="flashing" onClick="init()"><img src="https://static.igem.org/mediawiki/2018/1/18/T--Hebrewu--TCDD-invasion.png" width="800" heiht="600"> | ||
+ | </button> | ||
+ | </div> | ||
+ | </div> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | <!---game script---> | ||
+ | <script type="text/javascript"> | ||
+ | $(function() { | ||
+ | var images = ['https://static.igem.org/mediawiki/2018/1/12/T--hebrewu--Game1.png', 'https://static.igem.org/mediawiki/2018/7/74/T--Hebrewu--game_background_2.png','https://static.igem.org/mediawiki/2018/1/1e/T--hebrewu--Game2.png']; | ||
+ | $('#canvas').css({'background-image': 'url(' + images[Math.floor(Math.random() * images.length)] + ')'}); | ||
+ | }); | ||
+ | </script> | ||
− | |||
<script> | <script> | ||
− | + | function myFunction() { | |
− | + | var x = document.getElementById("myDIV"); | |
− | + | if (x.style.display === "none") { | |
− | + | x.style.display = "block"; | |
− | + | } else { | |
− | + | x.style.display = "none"; | |
− | + | ||
− | if ( | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | + | } | |
+ | </script> | ||
+ | |||
+ | <script> | ||
+ | function init() { | ||
+ | |||
+ | |||
+ | var x = document.getElementById("myDIV"); | ||
+ | |||
+ | if (x.style.display === "none") { | ||
+ | x.style.display = "block"; | ||
+ | } else { | ||
+ | x.style.display = "none"; | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | // defining the canvas | ||
+ | var canvas = document.getElementById("canvas"); | ||
+ | canvas.style.display = "block"; | ||
+ | canvas.width = 800; | ||
+ | canvas.height = 600; | ||
+ | |||
+ | // defining some variables | ||
+ | var c = canvas.getContext("2d"); | ||
+ | var WIDTH = canvas.width; | ||
+ | var HEIGHT = canvas.height; | ||
+ | var keys = []; | ||
+ | var theCoins = []; | ||
+ | var timeRemaining = 30; | ||
+ | var theBadGuys = []; | ||
+ | var spawnX, spawnY; | ||
+ | var gameOver = false; | ||
+ | var endMessage = ""; | ||
+ | var mouseX, mouseY; | ||
+ | var deltaX = 0; | ||
+ | var deltaY = 0; | ||
+ | var rotation = 0; | ||
+ | var xtarget = 0; | ||
+ | var ytarget = 0; | ||
+ | var theBullets = []; | ||
+ | var deltaX, deltaY, newAngle = 0; | ||
+ | var endStatsDisplay = "score"; | ||
+ | |||
+ | var coinCollectSwitcher = 1; | ||
+ | |||
+ | |||
+ | function loadImages() { | ||
+ | playerImage = new Image(); | ||
+ | playerImage.src = 'https://static.igem.org/mediawiki/2018/b/b2/T--Hebrewu--game_player.png'; | ||
+ | |||
+ | badGuyImage = new Image(); | ||
+ | badGuyImage.src = 'https://static.igem.org/mediawiki/2018/5/53/T--Hebrewu--game_badguy.png'; | ||
+ | |||
+ | |||
+ | |||
+ | balls = new Image(); | ||
+ | balls.src = 'https://static.igem.org/mediawiki/2018/9/98/T--Hebrewu--balls.png'; | ||
+ | |||
+ | } | ||
+ | loadImages(); | ||
+ | |||
+ | |||
+ | |||
+ | // construct a player | ||
+ | function Player () { | ||
+ | this.x = 285; | ||
+ | this.y = 290; | ||
+ | this.w = 200; | ||
+ | this.h = 45; | ||
+ | this.health = 200; | ||
+ | this.points = 0; | ||
+ | this.image = playerImage; | ||
+ | } | ||
+ | var Player1 = new Player(); | ||
+ | |||
+ | // set the game loop interval | ||
+ | createNewCoins(); | ||
+ | setInterval(mainDraw, 20); | ||
+ | |||
+ | |||
+ | function playerDraw() { | ||
+ | |||
+ | c.beginPath(); | ||
+ | |||
+ | c.strokeStyle="blue"; | ||
+ | //c.rect(Player1.x, Player1.y, Player1.w, Player1.h); | ||
+ | c.lineWidth=1; | ||
+ | c.stroke(); | ||
+ | |||
+ | c.save(); | ||
+ | deltaX = mouseX - Player1.x; | ||
+ | deltaY = mouseY - Player1.y; | ||
+ | newAngle = Math.atan(deltaY / deltaX); | ||
+ | |||
+ | c.translate(Player1.x + (Player1.w / 2), Player1.y + (Player1.h / 2) ); | ||
+ | if (deltaX < 0) { | ||
+ | c.rotate(newAngle); | ||
+ | c.scale(-1, 1); | ||
+ | } else { | ||
+ | c.rotate(newAngle); | ||
+ | } | ||
+ | |||
+ | c.drawImage(Player1.image, -(Player1.w / 2) - 7, -(Player1.h / 2) - 5, Player1.w * 1.3, Player1.h * 1.3); | ||
+ | |||
+ | c.restore(); | ||
+ | } | ||
+ | |||
+ | function createNewCoins() { | ||
+ | theCoins.push({x: Math.floor(Math.random() * 800),y: Math.floor(Math.random() * 600),w: 20,h: 20, points: 10, color: 'yellow', sourceX: 0, sourceY: 130, sourceW: 130, sourceH: 130}); | ||
+ | |||
+ | theCoins.push({x: Math.floor(Math.random() * 800),y: Math.floor(Math.random() * 600),w: 45,h: 45, points: 5, color: 'grey', sourceX: 130, sourceY: 130, sourceW: 130, sourceH: 130}); | ||
+ | |||
+ | theCoins.push({x: Math.floor(Math.random() * 800),y: Math.floor(Math.random() * 600),w: 60,h: 60, points: 2, color: 'brown', sourceX: 0, sourceY: 0, sourceW: 130, sourceH: 130}); | ||
+ | |||
+ | } | ||
+ | |||
+ | function drawCoins() { | ||
+ | theCoins.forEach( function(i, j) { | ||
+ | c.beginPath(); | ||
+ | c.strokeStyle=i.color; | ||
+ | // c.rect(i.x, i.y, i.w, i.h); | ||
+ | c.drawImage(balls, i.sourceX, i.sourceY, i.sourceW, i.sourceH, i.x, i.y, i.w, i.h); | ||
+ | c.lineWidth=1; | ||
+ | c.stroke(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function drawHUD() { | ||
+ | c.font = '18pt Calibri'; | ||
+ | c.fillStyle = 'white'; | ||
+ | c.fillText("Health:", 10, 25); | ||
+ | |||
+ | c.beginPath(); | ||
+ | if (Player1.health < 50) { | ||
+ | c.strokeStyle= 'red'; | ||
+ | } else { | ||
+ | c.strokeStyle= 'yellow'; | ||
+ | } | ||
+ | |||
+ | c.moveTo(85,18); | ||
+ | c.lineTo(85 + Player1.health, 18); | ||
+ | c.lineWidth=15; | ||
+ | c.stroke(); | ||
+ | |||
+ | c.fillStyle = 'white'; | ||
+ | c.fillText("Points:", 370, 25); | ||
+ | c.fillText("Time remaining:", 585, 25); | ||
+ | |||
+ | if (timeRemaining < 10) { | ||
+ | c.fillStyle = "red" | ||
+ | } | ||
+ | c.fillText(Math.ceil(timeRemaining), 750, 25); | ||
+ | |||
+ | c.fillStyle = 'yellow'; | ||
+ | c.fillText(Player1.points, 445, 25); | ||
+ | } | ||
+ | |||
+ | |||
+ | function collides(a, b) { | ||
+ | return !(a.x >= b.x + b.w || | ||
+ | a.x + a.w <= b.x || | ||
+ | a.y >= b.y + b.h || | ||
+ | a.y + a.h <= b.y); | ||
+ | } | ||
+ | |||
+ | |||
+ | function collidesStep(a, b) { | ||
+ | return !(a.x + a.xStep >= b.x + b.w || | ||
+ | a.x + a.xStep + a.w <= b.x || | ||
+ | a.y + a.yStep >= b.y + b.h || | ||
+ | a.y + a.yStep + a.h >= b.y); | ||
+ | } | ||
+ | |||
+ | function checkCollision() { | ||
+ | theCoins.forEach( function(i, j){ | ||
+ | if ( collides(i, Player1) ) { | ||
+ | Player1.points += i.points; | ||
+ | theCoins.splice(0); | ||
+ | createNewCoins(); | ||
+ | |||
+ | if (coinCollectSwitcher === 1) { | ||
+ | coinCollect1.play(); | ||
+ | } | ||
+ | |||
+ | if (coinCollectSwitcher === 2) { | ||
+ | coinCollect2.play(); | ||
+ | } | ||
+ | |||
+ | if (coinCollectSwitcher === 3) { | ||
+ | coinCollect3.play(); | ||
+ | } | ||
+ | if (coinCollectSwitcher === 4) { | ||
+ | coinCollect4.play(); | ||
+ | } | ||
+ | if (coinCollectSwitcher === 5) { | ||
+ | coinCollect5.play(); | ||
+ | } | ||
+ | if (coinCollectSwitcher === 6) { | ||
+ | coinCollect6.play(); | ||
+ | } | ||
+ | |||
+ | coinCollectSwitcher++; | ||
+ | |||
+ | if (coinCollectSwitcher === 7) { | ||
+ | coinCollectSwitcher = 1; | ||
+ | } | ||
+ | |||
+ | |||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | function endStats() { | ||
+ | |||
+ | if (keys[67]) { | ||
+ | endStatsDisplay = "credits"; | ||
+ | } | ||
+ | |||
+ | if (keys[83]) { | ||
+ | endStatsDisplay = "score"; | ||
+ | } | ||
+ | |||
+ | if (endStatsDisplay === "credits") { | ||
+ | c.font = '20pt Calibri'; | ||
+ | c.fillStyle = 'cyan'; | ||
+ | c.fillText("The code for the game was based on tutorial from frozenlizardproductions.com", 0, 30); | ||
+ | c.fillStyle = 'white'; | ||
+ | c.fillText("Graphics by HebrewU (Aliza Fedorenko)",200 , 100); | ||
+ | c.font = '30pt Calibri'; | ||
+ | c.fillStyle = 'white'; | ||
+ | c.fillText("Press enter to play again!", 190, 455); | ||
+ | c.fillText("Press S for score", 250, 520); | ||
+ | |||
+ | } | ||
+ | |||
+ | if (endStatsDisplay === "score") { | ||
+ | c.font = '60pt Calibri'; | ||
+ | c.fillStyle = 'white'; | ||
+ | c.fillText(endMessage, 70, 100); | ||
+ | |||
+ | c.font = '80pt Calibri'; | ||
+ | c.fillText("Your Score:", 70, 220); | ||
+ | c.fillStyle = 'yellow'; | ||
+ | c.fillText(Player1.points, 580, 220); | ||
+ | |||
+ | c.font = '30pt Calibri'; | ||
+ | c.fillStyle = 'white'; | ||
+ | c.fillText("Press enter to play again!", 190, 455); | ||
+ | c.fillText("Press C for credits", 250, 520); | ||
+ | |||
+ | c.fillStyle = 'cyan'; | ||
+ | } | ||
+ | |||
+ | if ( keys[13] ) { | ||
+ | Player1.points = 0; | ||
+ | theCoins.splice(0); | ||
+ | createNewCoins(); | ||
+ | timeRemaining = 30; | ||
+ | theBadGuys.splice(0); | ||
+ | Player1.x = 395; | ||
+ | Player1.y = 295; | ||
+ | gameOver = false; | ||
+ | Player1.health = 200; | ||
+ | theBullets.splice(0); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | function pushBadGuy() { | ||
+ | if (Math.random() < 0.5) { | ||
+ | spawnX = Math.random() < 0.5 ? -20 : 820; | ||
+ | spawnY = Math.random() * 600; | ||
+ | } else { | ||
+ | spawnX = Math.random() * 800; | ||
+ | spawnY = Math.random() < 0.5 ? -20 : 620; | ||
+ | } | ||
+ | theBadGuys.push( { | ||
+ | x: spawnX, y: spawnY, w: 30, h: 30, speed: Math.ceil(Math.random()* 2), hit: false, image: badGuyImage | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | function badGuyCollidesY (i, j, step) { | ||
+ | for (k = theBadGuys.length - 1; k >= 0; k--){ | ||
+ | if (j != k) { | ||
+ | if ( | ||
+ | i.x < theBadGuys[k].x + theBadGuys[k].w) { | ||
+ | |||
+ | if ( | ||
+ | i.x + i.w > theBadGuys[k].x) { | ||
+ | |||
+ | if ( | ||
+ | i.y + step < theBadGuys[k].y + theBadGuys[k].h) { | ||
+ | if (i.y + step + i.h > theBadGuys[k].y) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if (i.x + step < Player1.x + Player1.w) { | ||
+ | if (i.x + step + i.w > Player1.x) { | ||
+ | |||
+ | if (i.y < Player1.y + Player1.h) { | ||
+ | if (i.y + i.h > Player1.y) { | ||
+ | !i.hit | ||
+ | Player1.health -= 40; | ||
+ | if (Player1.health <= 0){ | ||
+ | gameOver = true; | ||
+ | endMessage = "Oh no! Game Over"; | ||
+ | } | ||
+ | i.hit = true; | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | }} | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function badGuyCollidesX (i, j, step) { | ||
+ | for (k = theBadGuys.length - 1; k >= 0; k--){ | ||
+ | if (j != k) { | ||
+ | if ( | ||
+ | i.x + step < theBadGuys[k].x + theBadGuys[k].w) { | ||
+ | |||
+ | if ( | ||
+ | i.x + step + i.w > theBadGuys[k].x) { | ||
+ | |||
+ | if ( | ||
+ | i.y < theBadGuys[k].y + theBadGuys[k].h) { | ||
+ | if (i.y + i.h > theBadGuys[k].y) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if (i.x + step < Player1.x + Player1.w) { | ||
+ | if (i.x + step + i.w > Player1.x) { | ||
+ | if (i.y < Player1.y + Player1.h) { | ||
+ | if (i.y + i.h > Player1.y) { | ||
+ | if (!i.hit) { | ||
+ | Player1.health -= 40; | ||
+ | if (Player1.health <= 0){ | ||
+ | gameOver = true; | ||
+ | endMessage = "Oh no! Game Over"; | ||
+ | } | ||
+ | } | ||
+ | i.hit = true; | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | }} | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | function badGuysMove() { | ||
+ | theBadGuys.forEach( function(i, j) { | ||
+ | if (i.x > Player1.x) { | ||
+ | if (!badGuyCollidesX(i, j, -i.speed)) {i.x -= i.speed;} | ||
+ | } | ||
+ | if (i.x < Player1.x) { | ||
+ | if (!badGuyCollidesX(i, j, -i.speed)) {i.x += i.speed;} | ||
+ | } | ||
+ | if (i.y > Player1.y) { | ||
+ | if (!badGuyCollidesY(i, j, -i.speed)) {i.y -= i.speed;} | ||
+ | } | ||
+ | if (i.y < Player1.y) { | ||
+ | if (!badGuyCollidesY(i, j, -i.speed)) {i.y += i.speed;} | ||
+ | } | ||
+ | |||
+ | if (i.hit === true){ theBadGuys.splice(j, 1); } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | //out the if on | ||
+ | |||
+ | function badGuysDraw() { | ||
+ | theBadGuys.forEach( function(i, j) { | ||
+ | c.beginPath(); | ||
+ | c.strokeStyle="red"; | ||
+ | // c.rect(i.x, i.y, i.w, i.h); | ||
+ | c.drawImage(i.image, i.x - 12 , i.y - 12, 50, 50); | ||
+ | c.lineWidth=1; | ||
+ | c.stroke(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function createBullet(targetX, targetY, shooterX, shooterY) { | ||
+ | if (!gameOver) { | ||
+ | console.log (gameOver); | ||
+ | deltaX = targetX - shooterX; | ||
+ | deltaY = targetY - shooterY; | ||
+ | rotation = Math.atan2(deltaY, deltaX); | ||
+ | xtarget = Math.cos(rotation); | ||
+ | ytarget = Math.sin(rotation); | ||
+ | |||
+ | theBullets.push({ | ||
+ | active:true, | ||
+ | x: shooterX, //updates | ||
+ | y: shooterY, | ||
+ | speed: 10, | ||
+ | xtarget: xtarget, | ||
+ | ytarget: ytarget, | ||
+ | w: 5, | ||
+ | h: 5, | ||
+ | color: 'red', | ||
+ | angle: rotation | ||
+ | }); | ||
+ | |||
+ | if (shotSwitcher === 1) { | ||
+ | laser1.currentTime = 0.1; | ||
+ | laser1.play(); | ||
+ | } | ||
+ | |||
+ | if (shotSwitcher === 2) { | ||
+ | laser2.currentTime = 0.1; | ||
+ | laser2.play(); | ||
+ | } | ||
+ | |||
+ | if (shotSwitcher === 3) { | ||
+ | laser3.currentTime = 0.1; | ||
+ | laser3.play(); | ||
+ | } | ||
+ | if (shotSwitcher === 4) { | ||
+ | laser4.currentTime = 0.1; | ||
+ | laser4.play(); | ||
+ | } | ||
+ | if (shotSwitcher === 5) { | ||
+ | laser5.currentTime = 0.1; | ||
+ | laser5.play(); | ||
+ | } | ||
+ | if (shotSwitcher === 6) { | ||
+ | laser6.currentTime = 0.1; | ||
+ | laser6.play(); | ||
+ | } | ||
+ | |||
+ | shotSwitcher++; | ||
+ | |||
+ | if (shotSwitcher === 7) { | ||
+ | shotSwitcher = 1; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | function bulletsMove() { | ||
+ | theBullets.forEach( function(i, j) { | ||
+ | i.x += i.xtarget * i.speed; | ||
+ | i.y += i.ytarget * i.speed; | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function bulletsDraw() { | ||
+ | theBullets.forEach( function(i, j) { | ||
+ | c.beginPath(); | ||
+ | c.save(); | ||
+ | c.fillStyle = i.color; | ||
+ | c.rect(i.x, i.y, i.w, i.h); | ||
+ | c.fill(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function checkBulletHits() { | ||
+ | if (theBullets.length > 0) { | ||
+ | if(theBadGuys.length > 0) { | ||
+ | for (j = theBullets.length - 1; j >= 0; j--) { | ||
+ | for (k = theBadGuys.length - 1; k >= 0; k--) { | ||
+ | if (collides(theBadGuys[k], theBullets[j])) { | ||
+ | console.log("collides"); | ||
+ | theBadGuys.splice(k, 1); | ||
+ | theBullets.splice(j, 1); | ||
+ | Player1.points += 1; | ||
+ | |||
+ | if (boomSwitcher === 1) { | ||
+ | boom1.play(); | ||
+ | } | ||
+ | |||
+ | if (boomSwitcher === 2) { | ||
+ | boom2.play(); | ||
+ | } | ||
+ | |||
+ | if (boomSwitcher === 3) { | ||
+ | boom3.play(); | ||
+ | } | ||
+ | if (boomSwitcher === 4) { | ||
+ | boom4.play(); | ||
+ | } | ||
+ | if (boomSwitcher === 5) { | ||
+ | boom5.play(); | ||
+ | } | ||
+ | if (boomSwitcher === 6) { | ||
+ | boom6.play(); | ||
+ | } | ||
+ | |||
+ | boomSwitcher++; | ||
+ | |||
+ | if (boomSwitcher === 7) { | ||
+ | boomSwitcher = 1; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | function mainDraw() { | ||
+ | c.clearRect(0, 0, WIDTH, HEIGHT); | ||
+ | if (!gameOver) { | ||
+ | playerMove(); | ||
+ | playerDraw(); | ||
+ | bulletsMove(); | ||
+ | bulletsDraw(); | ||
+ | checkBulletHits(); | ||
+ | drawCoins(); | ||
+ | drawHUD(); | ||
+ | checkCollision(); | ||
+ | |||
+ | badGuysMove(); | ||
+ | badGuysDraw(); | ||
+ | if (Math.random() * 100 < 1 ) { | ||
+ | pushBadGuy(); | ||
+ | } | ||
+ | |||
+ | timeRemaining -= 0.02; | ||
+ | if (timeRemaining < 0) { | ||
+ | gameOver = true; | ||
+ | endMessage = " You Survived!"; | ||
+ | } | ||
+ | } // if !gameOver | ||
+ | if (gameOver) { | ||
+ | endStats(); | ||
+ | } | ||
+ | |||
+ | } //mainDraw | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | function playerMove(e){ | ||
+ | |||
+ | if (keys[87]) { | ||
+ | if (Player1.y > 2) { | ||
+ | Player1.y -= 3; | ||
+ | } | ||
+ | } | ||
+ | if (keys[83] ) { | ||
+ | if (Player1.y < HEIGHT - Player1.h - 2) { | ||
+ | Player1.y += 3; | ||
+ | } | ||
+ | } | ||
+ | if (keys[65] ) { | ||
+ | if (Player1.x > 2) { | ||
+ | Player1.x -= 3; | ||
+ | } | ||
+ | } | ||
+ | if (keys[68] ) { | ||
+ | if (Player1.x < WIDTH - Player1.w - 2) { | ||
+ | Player1.x += 3; | ||
+ | } | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | canvas.addEventListener("keydown", function (e) { | ||
+ | keys[e.keyCode] = true; | ||
+ | }); | ||
+ | canvas.addEventListener("keyup", function (e) { | ||
+ | keys[e.keyCode] = false; | ||
+ | }); | ||
+ | |||
+ | canvas.addEventListener("click", function() { | ||
+ | if (!gameOver){ | ||
+ | createBullet(mouseX, mouseY, Player1.x + (Player1.w / 2), Player1.y + (Player1.h / 2)); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | function mouseMove(e) { | ||
+ | if(e.offsetX) { | ||
+ | mouseX = e.offsetX; | ||
+ | mouseY = e.offsetY; | ||
+ | } | ||
+ | else if (e.layerX) { | ||
+ | mouseX = e.layerX; | ||
+ | mouseY = e.layerY; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | canvas.addEventListener('mousemove', mouseMove, true); | ||
+ | |||
+ | } // init | ||
+ | |||
</script> | </script> | ||
+ | |||
+ | |||
+ | |||
+ | <!-- end game script --> | ||
+ | |||
+ | <!--game style--> | ||
+ | <style> | ||
+ | .flashing{ | ||
+ | border:none; | ||
+ | display:inline-block; | ||
+ | animation-name: flash; | ||
+ | animation-duration: 1s; | ||
+ | animation-timing-function: linear; | ||
+ | animation-iteration-count: infinite; | ||
+ | text-align:center; | ||
+ | |||
+ | /* Chrome 4+, Safari 4+, Opera 15+ */ | ||
+ | -webkit-animation-name: flash; | ||
+ | -webkit-animation-duration: 1s; | ||
+ | -webkit-animation-timing-function: linear; | ||
+ | -webkit-animation-iteration-count: infinite; | ||
+ | |||
+ | /* Firefox 5+ */ | ||
+ | -moz-animation-name: flash; | ||
+ | -moz-animation-duration: 1s; | ||
+ | -moz-animation-timing-function: linear; | ||
+ | -moz-animation-iteration-count: infinite | ||
+ | } | ||
+ | |||
+ | @keyframes flash { | ||
+ | 0% { opacity: 1.0 } | ||
+ | 50% { opacity: 0.5 } | ||
+ | 100% { opacity: 1.0 } | ||
+ | } | ||
+ | |||
+ | /* Chrome 4+, Safari 4+, Opera 15+ */ | ||
+ | @-webkit-keyframes flash { | ||
+ | 0% { opacity: 1.0 } | ||
+ | 50% { opacity: 0.5 } | ||
+ | 100% { opacity: 1.0 } | ||
+ | } | ||
+ | |||
+ | /* Firefox 5+ */ | ||
+ | @-moz-keyframes flash { | ||
+ | 0% { opacity: 1.0 } | ||
+ | 50% { opacity: 0.5 } | ||
+ | 100% { opacity: 1.0 } | ||
+ | } | ||
+ | |||
+ | |||
+ | </style> | ||
+ | |||
+ | <script> | ||
+ | var Mac = document.getElementById('huji_jamb'); | ||
+ | |||
+ | // When the user clicks anywhere outside of the modal, close it | ||
+ | window.onclick = function(event) { | ||
+ | //alert(event.target) | ||
+ | if (event.target == Mac) { | ||
+ | Mac.style.display = "none"; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </script> | ||
+ | |||
+ | <!--game style end--> | ||
Latest revision as of 17:54, 12 December 2018
Highlights:
We designed an open source platform where researchers anywhere can view our synthetic pathway and conduct their own research, inserting it into native plants and building upon our database.