/* This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details. */ /* Questions and obstacles are defined in the end of this file. */ function ld(num,d) { if (d==0) num=Math.floor(num/30) else num=Math.ceil(num/30) return num } function calc(dn) { if (!clcn) { clcn=true var pstr if (dn==star[num][3]) { pstr="class='green'>CORRECT!" saa[num]=3 corrects++ } else { pstr="class='red'>WRONG! ("+abc.substr(star[num][3]-1,1)+" was correct)" saa[num]=1 } starstaken++ bxd.innerHTML+="

" } } function showquestion() { bxd.style.display="block" bxd.style.width=(sqp*6.4-10)+"px" bxd.style.height=(sqp*4-10)+"px" bxd.style.marginLeft=(sqp*-3.2)+"px" bxd.style.marginTop=(sqp*-2)+"px" if (sqp<75) { sqp+=3 setTimeout("showquestion()",10) } else { clcn=false rsqw=true bxd.innerHTML="

"+star[num][1]+"

" for (var i=0;i"+abc.substr(i,1)+": "+star[num][2][i]+"

" } } } function bhidequestion() { bxd.innerHTML="" rsqw=false hidequestion() } function hidequestion() { bxd.style.width=(sqp*6.4-10)+"px" bxd.style.height=(sqp*4-10)+"px" bxd.style.marginLeft=(sqp*-3.2)+"px" bxd.style.marginTop=(sqp*-2)+"px" if (sqp>0) { sqp-=3 setTimeout("hidequestion()",10) } else { bxd.style.display="none" sqp=1 qs=false } } function nrmlclr() { if (ncc) { qe=true hclr="#ff0000" ctxo.style.backgroundColor="#ff0000" ncc=false setTimeout("nrmlclr()",500) } else { ncc=true hclr="#000" ctxo.style.backgroundColor="#000" qe=false } } function motion() { var i,pi ctx.clearRect(0,0,640,400) if (p>305 && pend-291) pp=305+p-end+291 else pp=p if (!rsqw) { if (j<0) { jumping=false j=0 jc=5 l=41 a=21 } if (jumping) { if (j>200) jc=-6 if (jc>=0) j+=jc-j/100 else j+=jc+j/100 } } if (!walkingr && !walkingl) { cutd=0 ta=1 } if (cutd<10) speed=ospeed+cutd/3 ctx.strokeStyle="#fff" ctx.lineWidth=2 // BACKGROUND for (pi=0;piy && saa[i]==2 && !qs) { qs=true num=i sqp=1 showquestion() } if (x+starw>0 && x<640) { if (saa[i]==2) ctx.drawImage(starimg,x,y) else if (saa[i]==1 && stadu) ctx.drawImage(starimgu,x,y) else if (saa[i]==3 && stadk) ctx.drawImage(starimgk,x,y) } } } // TRAPS if (trapd) { for (i=0;ix && pp+40y && !qs && !qe) { timeshurt++ nrmlclr() } if (x+trapw>0 && x<640) ctx.drawImage(trapimg,x,y) } } // STICK FIGURE START // LEGS ctx.beginPath() ctx.moveTo(pp+l,400-j) ctx.lineTo(pp+20,350-j) ctx.lineTo(pp+40-l,400-j) // BODY ctx.moveTo(pp+20,350-j) ctx.lineTo(pp+20,300-j) // ARMS ctx.moveTo(pp+20,320-j) ctx.lineTo(pp+10+a,350-j) ctx.moveTo(pp+20,320-j) ctx.lineTo(pp+30-a,350-j) ctx.stroke() // HEAD ctx.fillStyle=hclr ctx.beginPath() ctx.arc(pp+20,285-j,15,0,Math.PI*2,true) ctx.fill() ctx.stroke() // EYE ctx.fillStyle="#fff" ctx.beginPath() ctx.arc(pp+eyex,eyey-j,3,0,Math.PI*2,true) ctx.fill() // MOUTH ctx.beginPath() ctx.lineCap="round" ctx.moveTo(pp+mouthax,mouthay-j) ctx.lineTo(pp+mouthbx,mouthby-j) ctx.stroke() // STICK FIGURE END if (!rsqw) { if (p>=end) p=end-1 else if (p<0) p=0 if (p-1 && (walkingr || walkingl)) { if (!jumping) { if (l>40) lc=-1 else if (l<1) lc=1 if (a>20) ac=-.5 else if (a<1) ac=.5 l+=lc*speed a+=ac*speed } if (walkingr) p+=speed else p-=speed } if (jumping) { l=60 a=40 } if (p>end || p<0) { a=20 l=40 } } if (p>=end) endgame() cht=setTimeout("motion()",20) } function endgame() { if (starstaken

Your grade is...
"+grade+"

OK

" } } function endall() { document.body.removeChild(bxd) document.body.removeChild(ctxo) } function md(e) { if (window.event) kc=window.event.keyCode else if (e) kc=e.which if (!walkingr && kc==39) { walkingr=true walkingl=false cutd=0 } if (!walkingl && kc==37) { walkingr=false walkingl=true cutd=0 } else if (!jumping && kc==38) jumping=true if (walkingl) { eyex=12 eyey=283 mouthax=20 mouthay=293 mouthbx=10 mouthby=295 } else if (walkingr) { eyex=28 eyey=283 mouthax=30 mouthay=295 mouthbx=20 mouthby=293 } } function mu(e) { if (window.event) kc=window.event.keyCode else if (e) kc=e.which if (walkingr && kc==39) walkingr=false if (walkingl && kc==37) walkingl=false } function time() { if (cutd==0) ta=1 cutd+=ta } function load() { var i fdng=100 ospeed=3 speed=ospeed p=0 l=0 a=0 walkingr=false walkingl=false jumping=false jc=5 j=0 qs=false qe=false rsqw=false corrects=0 starstaken=0 abc="ABCDEFGH" cutd=0 ta=1 ncc=true hclr="#000" timeshurt=0 // BACKGROUNDS bg=new Array() bg[0]=new Array() bg[0][0]=new Image() bg[0][0].src="Cerebral_lobes.png" bg[0][1]=.5 bg[0][2]=20 bg[1]=new Array() bg[1][0]=new Image() bg[1][0].src="Cerveau_anime.gif" bg[1][1]=1 bg[1][2]=90 bg[2]=new Array() bg[2][0]=new Image() bg[2][0].src="Friendly_stickman.png" bg[2][1]=1.5 bg[2][2]=170 bgl=bg.length // STARS star=new Array() star[0]=new Array() star[0][0]=[200,3] star[0][1]="To what extent does bicycles apply to world economics?" star[0][2]=["A great extent","A noticable extent","Nothing at all","I don't know"] star[0][3]=4 star[1]=new Array() star[1][0]=[650,80] star[1][1]="What is a chocobo?" star[1][2]=["A fictional bird","A fictional frog","A real bird","A real frog"] star[1][3]=1 star[2]=new Array() star[2][0]=[850,100] star[2][1]="What is the size of an average male human brain?" star[2][2]=["1200-1300cm3","1100-1200cm3","1300-1400cm3","1000-1100cm3"] star[2][3]=2 star[3]=new Array() star[3][0]=[1200,23] star[3][1]="What is 2 * 8^(1/3) + 4?" star[3][2]=["2","4","6","8"] star[3][3]=4 star[4]=new Array() star[4][0]=[1577,150] star[4][1]="What colour is the beak of a male blackbird?" star[4][2]=["Grey","Black","Brown","Orange"] star[4][3]=4 star[5]=new Array() star[5][0]=[1700,10] star[5][1]="Do you like this quiz?" star[5][2]=["Yes","No","Perhaps","Eventually","Maybe","Depends"] star[5][3]=1 star[6]=new Array() star[6][0]=[1900,20] star[6][1]="Who is Horacio Peņa?" star[6][2]=["An actor","A writer"] star[6][3]=2 star[7]=new Array() star[7][0]=[2222,111] star[7][1]="When did Monkey Island reveal its truth?" star[7][2]=["1990","1991","1992","Hasn't happened yet"] star[7][3]=4 star[8]=new Array() star[8][0]=[2500,23] star[8][1]="Do you gimp?" star[8][2]=["No, I photoshop.","Yes."] star[8][3]=2 starl=star.length Array.prototype.add=function(x,y){this[this.length]=[x,y]} // TRAPS trap=new Array() trap.add(100,5) trap.add(300,60) trap.add(350,43) trap.add(660,20) trap.add(700,250) trap.add(750,250) trap.add(800,250) trap.add(860,2) trap.add(920,30) trap.add(930,40) trap.add(940,50) trap.add(1250,40) trap.add(1400,68) trap.add(1537,10) trap.add(1567,10) trap.add(1597,10) trap.add(1700,170) trap.add(1800,64) trap.add(1950,3) trap.add(1950,23) trap.add(1950,43) trap.add(1950,63) trap.add(1950,203) trap.add(2200,10) trap.add(2375,10) trap.add(2435,10) trapl=trap.length saa=new Array() for (i=0;i0) { fdng-=8 setTimeout("startgame()",10) } else { document.onkeydown=md document.onkeyup=mu strt.style.display="none" motion() setInterval("time()",500) } } window.onload=load