Guest User

Untitled

a guest
Aug 23rd, 2015
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var aQTexts = ["Damn, I would bang the professor" , "DAT ASS ;)" , "So smart"];
  2. var bQTexts = ["Not perfect but well above average" , "Almost my favorite professor" , "I wonder what color his undies are"];
  3. var cQTexts = ["Pretty average, BORING" , "Lectures are a drag, but there is worse" , "Not bad"];
  4. var dQTexts = ["The professor smells" , "The professor is a dick" , "Needs to learn to teach"];
  5. var fQTexts = ["FUCK THE PROFESSOR, NOT THE GOOD KIND" , "How could someone suck so much" , "Just stop trying to teach"];
  6. //online comments
  7. var aQOnline = ["Super nice professor, also super hot" , "Can actually teach" , "Best professor ever"];
  8. var bQOnline = ["Really good professor, probably second best" , "Almost perfect" , "Really knows the material"];
  9. var cQOnline = ["Average professor" , "Goes through the motions, but not the worst" , "Not bad, I guess"];
  10. var dQOnline = ["Hard professor" , "Actually takes attendance, dick" , "He just sucks"];
  11. var fQOnline = ["STAY AWAY" , "Horrible professor" , "SUCKS ASS"];
  12. //interations
  13. var aQInteractions = ["Had coitus" , "Gave you his/her sisters number" , "Sent his/her mother over"];
  14. var bQInteractions = ["Compliments you daily" , "Brought you an apple" , "Blows kisses at you"];
  15. var cQInteractions = ["Show up to class on time " , "Turns on work most of the time" , "Never mean"];
  16. var dQInteractions = ["Only a tease" , "No reach around" , "Never called you back"];
  17. var fQInteractions = ["Turned you in after you hit on them" , "Spread rumors about your small genitals" , "Total dude-bro douche in class"];
  18.  
  19.  
  20. //first names
  21. //male first name
  22. var maleFName = ["Eric", "Ross", "Adam","Anthony", "CJ", "Chris", "Andrew", "Fred", "Steven", "Josh"];
  23. var femaleFName = ["Laura", "Denise", "Shella","Sara", "Michelle", "Bethany", "Lauren", "Leslie", "Abby"];
  24. var lastName = ["Hambone" , "Smellie", "Shufflebottom", "Dungworth", "Hardmeat", "Bottom", "Willy", "Turtle", "Hogwood", "Greedy", "Rattlebag", "Jelly", "Demon", "Nutters", "Cornfest", "Bonefat", "Steer", "Pigfat", "Piggs"];
  25.  
  26. var grade = 0;
  27. var letterGrade = "z";
  28. var gameOn = true;
  29. var keyState = -1;
  30.  
  31. var monstersCaught = 0;
  32. //actual vars
  33. var semesterOn = 1;
  34. var meterCount = 5;
  35. var gameState = "play";
  36. var correctlyGraded = 0;
  37.  
  38.  
  39.  
  40. //creating and appending the canvas
  41. var canvas = document.createElement("canvas");
  42. var ctx = canvas.getContext("2d");
  43. canvas.width = 800;
  44. canvas.height = 600;
  45. document.body.appendChild(canvas);
  46.  
  47. //loading a sound effect
  48. var snd = new Audio("audio/sample.wav");
  49. var no = new Audio("audio/no.wav");
  50.  
  51. //sounds for letter grade
  52. var getA = new Audio("audio/getA.wav");
  53. var getB = new Audio("audio/getB.wav");
  54. var getC = new Audio("audio/getC.wav");
  55. var getD = new Audio("audio/getD.wav");
  56. var getF = new Audio("audio/getF.wav");
  57.  
  58.  
  59.  
  60.  
  61. //loading the images
  62. //bg image
  63. var bgReady = false;
  64. var bgImage = new Image();
  65. bgImage.onload = function ()
  66. {
  67.     bgReady = true;
  68. }
  69. bgImage.src = "images/bgBP.png";
  70.  
  71.  
  72.  
  73. //images for the game
  74. //comments
  75. var commentsReady = false;
  76. var commentsImage = new Image();
  77. commentsImage.onload = function ()
  78. {
  79.     commentsReady = true;
  80. }
  81. commentsImage.src = "images/comments.png";
  82.  
  83.  
  84. //online
  85. var onlineReady = false;
  86. var onlineImage = new Image();
  87. onlineImage.onload = function ()
  88. {
  89.     onlineReady = true;
  90. }
  91. onlineImage.src = "images/online.png";
  92.  
  93.  
  94. //interactions
  95. var interactionsReady = false;
  96. var interactionsImage = new Image();
  97. interactionsImage.onload = function ()
  98. {
  99.     interactionsReady = true;
  100. }
  101. interactionsImage.src = "images/interactions.png";
  102.  
  103.  
  104. //grade decals
  105. var aReady = false;
  106. var aImage = new Image();
  107. aImage.onload = function ()
  108. {
  109.     aReady = true;
  110. }
  111. aImage.src = "images/a.png";
  112.  
  113. var bReady = false;
  114. var bImage = new Image();
  115. bImage.onload = function ()
  116. {
  117.     bReady = true;
  118. }
  119. bImage.src = "images/b.png";
  120.  
  121. var cReady = false;
  122. var cImage = new Image();
  123. cImage.onload = function ()
  124. {
  125.     cReady = true;
  126. }
  127. cImage.src = "images/c.png";
  128.  
  129. var dReady = false;
  130. var dImage = new Image();
  131. dImage.onload = function ()
  132. {
  133.     dReady = true;
  134. }
  135. dImage.src = "images/d.png";
  136.  
  137. var fReady = false;
  138. var fImage = new Image();
  139. fImage.onload = function ()
  140. {
  141.     fReady = true;
  142. }
  143. fImage.src = "images/f.png";
  144.  
  145. var controlsReady = false;
  146. var controlsImage = new Image();
  147. controlsImage.onload = function ()
  148. {
  149.     controlsReady = true;
  150. }
  151. controlsImage.src = "images/controls.png";
  152.  
  153.  
  154.  
  155. var testReady = false;
  156. var testImage = new Image();
  157. testImage.onload = function (){
  158.     testReady = true;
  159. }
  160. testImage.src = "images/test.png";
  161.  
  162. var quizReady = false;
  163. var quizImage = new Image();
  164. quizImage.onload = function (){
  165.     quizReady = true;
  166. }
  167. quizImage.src = "images/quiz.png";
  168.  
  169. var paperReady = false;
  170. var paperImage = new Image();
  171. paperImage.onload = function (){
  172.     paperReady = true;
  173. }
  174. paperImage.src = "images/paper.png";
  175.  
  176.  
  177.  
  178. //id images(8 of em)
  179. var idBoyOneReady = false;
  180. var idBoyOneImage = new Image();
  181. idBoyOneImage.onload = function ()
  182. {
  183.     idBoyOneReady = true;
  184. }
  185. idBoyOneImage.src = "images/boyOne.png";
  186.  
  187. var idBoyTwoReady = false;
  188. var idBoyTwoImage = new Image();
  189. idBoyTwoImage.onload = function ()
  190. {
  191.     idBoyTwoReady = true;
  192. }
  193. idBoyTwoImage.src = "images/boyTwo.png";
  194.  
  195. var idBoyThreeReady = false;
  196. var idBoyThreeImage = new Image();
  197. idBoyThreeImage.onload = function ()
  198. {
  199.     idBoyThreeReady = true;
  200. }
  201. idBoyThreeImage.src = "images/boyThree.png";
  202.  
  203. var idBoyFourReady = false;
  204. var idBoyFourImage = new Image();
  205. idBoyFourImage.onload = function ()
  206. {
  207.     idBoyFourReady = true;
  208. }
  209. idBoyFourImage.src = "images/boyFour.png";
  210.  
  211. //load female ID's
  212. var idGirlOneReady = false;
  213. var idGirlOneImage = new Image();
  214. idGirlOneImage.onload = function ()
  215. {
  216.     idGirlOneReady = true;
  217. }
  218. idGirlOneImage.src = "images/girlOne.png";
  219.  
  220. var idGirlTwoReady = false;
  221. var idGirlTwoImage = new Image();
  222. idGirlTwoImage.onload = function ()
  223. {
  224.     idGirlTwoReady = true;
  225. }
  226. idGirlTwoImage.src = "images/girlTwo.png";
  227.  
  228. var idGirlThreeReady = false;
  229. var idGirlThreeImage = new Image();
  230. idGirlThreeImage.onload = function ()
  231. {
  232.     idGirlThreeReady = true;
  233. }
  234. idGirlThreeImage.src = "images/girlThree.png";
  235.  
  236. var idGirlFourReady = false;
  237. var idGirlFourImage = new Image();
  238. idGirlFourImage.onload = function ()
  239. {
  240.     idGirlFourReady = true;
  241. }
  242. idGirlFourImage.src = "images/girlFour.png";
  243.  
  244.  
  245.  
  246. //bad meter
  247. var badReady = false;
  248. var badImage = new Image();
  249. badImage.onload = function ()
  250. {
  251.     badReady = true;
  252. }
  253. badImage.src = "images/bad.png";
  254.  
  255. //fired text
  256. var firedReady = false;
  257. var firedImage = new Image();
  258. firedImage.onload = function ()
  259. {
  260.     firedReady = true;
  261. }
  262. firedImage.src = "images/fired.png";
  263.  
  264. var playReady = false;
  265. var playImage = new Image();
  266. playImage.onload = function ()
  267. {
  268.     playReady = true;
  269. }
  270. playImage.src = "images/playAgain.png";
  271.  
  272. var titleReady = false;
  273. var titleImage = new Image();
  274. titleImage.onload = function ()
  275. {
  276.     titleReady = true;
  277. }
  278. titleImage.src = "images/title.png";
  279.  
  280.  
  281. var howReady = false;
  282. var howImage = new Image();
  283. howImage.onload = function ()
  284. {
  285.     howReady = true;
  286. }
  287. howImage.src = "images/how.png";
  288.  
  289.  
  290. var playFReady = false;
  291. var playFImage = new Image();
  292. playFImage.onload = function ()
  293. {
  294.     playFReady = true;
  295. }
  296. playFImage.src = "images/playF.png";
  297.  
  298. var theTextReady = false;
  299. var theTextImage = new Image();
  300. theTextImage.onload = function ()
  301. {
  302.     theTextReady = true;
  303. }
  304. theTextImage.src = "images/theText.png";
  305.  
  306.  
  307.  
  308.  
  309.  
  310. //objects for the studnet
  311. var student =  {
  312.     sex: "",
  313.     fName: "",
  314.     lName: "",
  315.     iDent: "",
  316.     comment: "",
  317.     commentQ: "",
  318.     onlineComment: "",
  319.     onlineCommentQ: "",
  320.     interaction: "",
  321.     interactionQ: "",
  322.     assignment: ""
  323. };
  324.  
  325. //objects for the text-images
  326. var comments = {
  327.     x: 0,
  328.     y: 100
  329. };
  330.  
  331. var online = {
  332.     x: 0,
  333.     y: 250
  334. };
  335.  
  336. var interactions = {
  337.     x: 0,
  338.     y: 450
  339. };
  340.  
  341. //objects for grade decals
  342. var a = {
  343.     x: 300,
  344.     y: 550
  345. };
  346. var b = {
  347.     x: 350,
  348.     y: 550
  349. };
  350. var c = {
  351.     x: 400,
  352.     y: 550
  353. };
  354. var d = {
  355.     x: 450,
  356.     y: 550
  357. };
  358. var f = {
  359.     x: 500,
  360.     y: 550
  361. };
  362.  
  363. var controls = {
  364.     x: 120,
  365.     y: 560
  366. };
  367.  
  368.  
  369. //class work objects
  370. var test = {
  371.     x: 300,
  372.     y: 150
  373. };
  374.  
  375.  
  376. //objetcs for picture id's
  377. var boyOne = {
  378.     x: 650,
  379.     y: 60
  380. };
  381.  
  382. //obejcts for the positions of the texts/comments/interations
  383. var textPos = {
  384.     x:20,
  385.     y:135
  386. };
  387. var onlinePos = {
  388.     x:20,
  389.     y:300
  390. };
  391.  
  392. var interactionPos = {
  393.     x:20,
  394.     y:485
  395. };
  396.  
  397.  
  398. var bad = {
  399.     x:290,
  400.     y:532
  401. };
  402.  
  403. var studentPos = {
  404.     x:565,
  405.     y:177
  406. };
  407.  
  408. var semesterPos = {
  409.     x:435,
  410.     y:73
  411. };
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418. //player input
  419. var keysDown = {};
  420.  
  421. addEventListener("keydown", function (e) {
  422.     keysDown[e.keyCode] = true;
  423. }, false);
  424.  
  425. addEventListener("keyup", function (e) {
  426.     delete keysDown[e.keyCode];
  427. }, false);
  428.  
  429.  
  430. //initiate a new game(resets the hero position and the player position)
  431. var reset = function (){
  432.  
  433. }
  434.  
  435. var updateSemester = function() {
  436.     if (correctlyGraded % 4 == 0 && correctlyGraded != 0)
  437.     {
  438.         semesterOn++;
  439.         correctlyGraded = 0;
  440.     }
  441.  
  442.  
  443. }
  444.  
  445. //update the game objects
  446. var update = function (modifier) {
  447.  
  448.     //a = 65
  449.     //b = 66
  450.     //c = 67
  451.     //d = 68
  452.     //f = 70
  453.     //check for keys pressed
  454.     if (gameOn){
  455.  
  456.         if (65 in keysDown) {
  457.  
  458.             gameOn = false;
  459.             keyState = 65;
  460.  
  461.             if (letterGrade != 'a'){
  462.                 meterCount--;
  463.                 no.play();
  464.             }
  465.             else {
  466.                 snd.play();
  467.                 getA.play();
  468.                 correctlyGraded++;
  469.             }
  470.  
  471.  
  472.         }
  473.  
  474.         if (66 in keysDown) {
  475.             gameOn = false;
  476.             keyState = 66;
  477.  
  478.             if (letterGrade != 'b'){
  479.                 meterCount--;
  480.                 no.play();
  481.             }
  482.             else {
  483.                 snd.play();
  484.                 getB.play();
  485.                 correctlyGraded++;
  486.             }
  487.         }
  488.  
  489.         if (67 in keysDown) {
  490.             gameOn = false;
  491.             keyState = 67;
  492.  
  493.             if (letterGrade != 'c'){
  494.                 meterCount--;
  495.                 no.play();
  496.             }
  497.             else {
  498.                 snd.play();
  499.                 getC.play();
  500.                 correctlyGraded++;
  501.             }
  502.         }
  503.  
  504.         if (68 in keysDown) {
  505.             gameOn = false;
  506.             keyState = 68;
  507.  
  508.             if (letterGrade != 'd'){
  509.                 meterCount--;
  510.                 no.play();
  511.             }
  512.             else {
  513.                 snd.play();
  514.                 getD.play();
  515.                 correctlyGraded++;
  516.             }
  517.         }
  518.  
  519.         if (70 in keysDown) {
  520.             gameOn = false;
  521.             keyState = 70;
  522.  
  523.             if (letterGrade != 'f'){
  524.                 meterCount--;
  525.                 no.play();
  526.             }
  527.             else {
  528.                 snd.play();
  529.                 getF.play();
  530.                 correctlyGraded++;
  531.             }
  532.         }
  533.  
  534.     }
  535.  
  536.     updateSemester();
  537.     if (meterCount <= 0)
  538.         gameState = "end";
  539.  
  540.     if (!gameOn && !(keyState in keysDown))
  541.         continueGame();
  542. };
  543.  
  544.  
  545. var assignStudent = function (){
  546.  
  547.     //pick the gender of the student
  548.     var r = Math.floor((Math.random() * 2) + 1);
  549.     if (r == 1) {
  550.         student.sex = "m";
  551.         student.fName = maleFName[Math.floor((Math.random() * maleFName.length))] //pick male first name
  552.  
  553.         //assign id for males
  554.         r = Math.floor((Math.random() * 4) + 1);
  555.  
  556.         if (r == 1) {
  557.             student.iDent = idBoyOneImage;
  558.         }
  559.         else if (r == 2) {
  560.             student.iDent = idBoyTwoImage;
  561.         }
  562.         else if (r == 3) {
  563.             student.iDent = idBoyThreeImage;
  564.         }
  565.         else if (r == 4) {
  566.             student.iDent = idBoyFourImage;
  567.         }
  568.  
  569.  
  570.     }
  571.     else{
  572.         student.sex = "f";
  573.         student.fName = femaleFName[Math.floor((Math.random() * femaleFName.length))] //pick female first name
  574.  
  575.         //assign ID for females
  576.         r = Math.floor((Math.random() * 4) + 1);
  577.  
  578.         if (r == 1) {
  579.             student.iDent = idGirlOneImage;
  580.         }
  581.         else if (r == 2) {
  582.             student.iDent = idGirlTwoImage;
  583.         }
  584.         else if (r == 3) {
  585.             student.iDent = idGirlThreeImage;
  586.         }
  587.         else if (r == 4) {
  588.             student.iDent = idGirlFourImage;
  589.         }
  590.  
  591.  
  592.     }
  593.     //assign last name
  594.     student.lName = lastName[Math.floor((Math.random() * lastName.length))] //pick female first name
  595.  
  596.     //pick assignment
  597.     r = Math.floor((Math.random() * 3) + 1);
  598.     if (r == 1){
  599.         student.assignment = testImage;
  600.     }
  601.     else if (r == 2){
  602.         student.assignment = quizImage;
  603.     }
  604.     else if (r == 3){
  605.         student.assignment = paperImage;
  606.     }
  607.  
  608.     //pick comment quality
  609.     r = Math.floor((Math.random() * 5) + 1);
  610.     if (r == 1) {
  611.         student.commentQ = 55;
  612.         student.comment = fQTexts[Math.floor((Math.random() * fQTexts.length))];
  613.  
  614.     }
  615.     else if (r == 2) {
  616.         student.commentQ = 65;
  617.         student.comment = dQTexts[Math.floor((Math.random() * dQTexts.length))];
  618.     }
  619.     else if (r == 3) {
  620.         student.commentQ = 75;
  621.         student.comment = cQTexts[Math.floor((Math.random() * cQTexts.length))];
  622.     }
  623.     else if (r == 4) {
  624.         student.commentQ = 85;
  625.         student.comment = bQTexts[Math.floor((Math.random() * bQTexts.length))];
  626.     }
  627.     else if (r == 5){
  628.         student.commentQ = 95;
  629.         student.comment = aQTexts[Math.floor((Math.random() * aQTexts.length))];
  630.     }
  631.  
  632.     //pick online comments
  633.     r = Math.floor((Math.random() * 5) + 1);
  634.     if (r == 1) {
  635.         student.onlineCommentQ = 55;
  636.         student.onlineComment = fQOnline[Math.floor((Math.random() * fQOnline.length))];
  637.  
  638.     }
  639.     else if (r == 2) {
  640.         student.onlineCommentQ = 65;
  641.         student.onlineComment = dQOnline[Math.floor((Math.random() * dQOnline.length))];
  642.     }
  643.     else if (r == 3) {
  644.         student.onlineCommentQ = 75;
  645.         student.onlineComment= cQOnline[Math.floor((Math.random() * cQOnline.length))];
  646.     }
  647.     else if (r == 4) {
  648.         student.onlineCommentQ = 85;
  649.         student.onlineComment = bQOnline[Math.floor((Math.random() * bQOnline.length))];
  650.     }
  651.     else if (r == 5){
  652.         student.onlineCommentQ = 95;
  653.         student.onlineComment = aQOnline[Math.floor((Math.random() * aQOnline.length))];
  654.     }
  655.     //pick interaction
  656.     r = Math.floor((Math.random() * 5) + 1);
  657.     if (r == 1) {
  658.         student.interactionQ = 55;
  659.         student.interaction = fQInteractions[Math.floor((Math.random() * fQInteractions.length) )];
  660.  
  661.     }
  662.     else if (r == 2) {
  663.         student.interactionQ = 65;
  664.         student.interaction = dQInteractions[Math.floor((Math.random() * dQInteractions.length))];
  665.     }
  666.     else if (r == 3) {
  667.         student.interactionQ = 75;
  668.         student.interaction = cQInteractions[Math.floor((Math.random() * cQInteractions.length))];
  669.     }
  670.     else if (r == 4) {
  671.         student.interactionQ = 85;
  672.         student.interaction = bQInteractions[Math.floor((Math.random() * bQInteractions.length))];
  673.     }
  674.     else if (r == 5){
  675.         student.interactionQ = 95;
  676.         student.interaction = aQInteractions[Math.floor((Math.random() * aQInteractions.length))];
  677.     }
  678.  
  679. }
  680.  
  681.  
  682. var calcGrade = function() {
  683.     grade = (student.commentQ + student.onlineCommentQ + student.interactionQ)/3;
  684.     if (grade < 60)
  685.         letterGrade = "f";
  686.     else if (grade < 70)
  687.         letterGrade = "d";
  688.     else if (grade < 80)
  689.         letterGrade = "c";
  690.     else if (grade < 90)
  691.         letterGrade = "b";
  692.     else if (grade <= 100)
  693.         letterGrade = "a";
  694. }
  695.  
  696. var continueGame = function () {
  697.     gameOn = true;
  698.     assignStudent();
  699.     calcGrade();
  700.     console.log(grade);
  701. }
  702.  
  703.  
  704. //actual game reset
  705. var gameGo = function () {
  706.     //the game has started
  707.     semesterOn = 1;
  708.     keyState = -1;
  709.     meterCount = 5;
  710.     grade = 0;
  711.     letterGrade = "z";
  712.     gameState = "start"; //reset the game state
  713.     correctlyGraded = 0;
  714.     continueGame();
  715. }
  716.  
  717. var gameGoS = function () {
  718.     //the game has started
  719.     semesterOn = 1;
  720.     keyState = -1;
  721.     meterCount = 5;
  722.     grade = 0;
  723.     letterGrade = "z";
  724.     gameState = "play"; //reset the game state
  725.     correctlyGraded = 0;
  726.     continueGame();
  727. }
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734. //draw the objects
  735. // Draw everything
  736. var render = function () {
  737.     if (bgReady) {
  738.         ctx.drawImage(bgImage, 0, 0);
  739.     }
  740.  
  741.     //actual game rendering
  742.     //render the text-images
  743.     if (commentsReady) {
  744.         ctx.drawImage(commentsImage, comments.x, comments.y);
  745.     }
  746.     if (onlineReady) {
  747.         ctx.drawImage(onlineImage, online.x, online.y);
  748.     }
  749.     if (interactionsReady) {
  750.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  751.         ctx.drawImage(interactionsImage, interactions.x, interactions.y);
  752.     }
  753.  
  754.     //render the grade decals
  755.     if (aReady) {
  756.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  757.         ctx.drawImage(aImage, a.x, a.y);
  758.     }
  759.     if (bReady) {
  760.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  761.         ctx.drawImage(bImage, b.x, b.y);
  762.     }
  763.     if (cReady) {
  764.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  765.         ctx.drawImage(cImage, c.x, c.y);
  766.     }
  767.     if (dReady) {
  768.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  769.         ctx.drawImage(dImage, d.x, d.y);
  770.     }
  771.     if (fReady) {
  772.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  773.         ctx.drawImage(fImage, f.x, f.y);
  774.     }
  775.  
  776.     //controls image
  777.     if (controlsReady) {
  778.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  779.         ctx.drawImage(controlsImage, controls.x, controls.y);
  780.     }
  781.  
  782.     //class work images
  783.     if (testReady && paperReady && quizReady) {
  784.         ctx.drawImage(student.assignment, test.x, test.y);
  785.     }
  786.  
  787.     //check that all picture ID's are ready
  788.     if (idBoyOneReady && idBoyTwoReady && idBoyThreeReady && idBoyFourReady && idBoyFourReady && idGirlOneReady &&
  789.         idGirlTwoReady && idGirlThreeReady && idGirlFourReady) {
  790.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  791.         ctx.drawImage(student.iDent, boyOne.x, boyOne.y);
  792.     }
  793.  
  794.     //drawing the bad meter
  795.     if (badReady) {
  796.         //ctx.rotate(Math.PI / 180 * 3); //increment the angle and rotate the image
  797.         var temp = 0;
  798.         for (var i = 0; i < meterCount; i++)
  799.         {
  800.             ctx.drawImage(badImage, bad.x + temp, bad.y);
  801.             temp += 20;
  802.         }
  803.     }
  804.  
  805.  
  806.     //title
  807.     ctx.fillStyle = "rgb(0, 0, 0)";
  808.     ctx.font = "24px Lucida Console";
  809.     ctx.textAlign = "left";
  810.     ctx.textBaseline = "top";
  811.     ctx.fillText("Bad Professor",300,32);
  812.  
  813.     //semester
  814.     ctx.fillStyle = "rgb(0, 0, 0)";
  815.     ctx.font = "20px Lucida Console";
  816.     ctx.textAlign = "left";
  817.     ctx.textBaseline = "top";
  818.     ctx.fillText("Semester: ",320,70);
  819.  
  820.     //student name text
  821.     ctx.fillStyle = "rgb(0, 0, 0)";
  822.     ctx.font = "20px Lucida Console";
  823.     ctx.textAlign = "left";
  824.     ctx.textBaseline = "top";
  825.     ctx.fillText("Student name: ",400,175);
  826.  
  827.  
  828.     //comments,online,interations
  829.     //comments
  830.  
  831.  
  832.     //A 57 191 69
  833. //B 54 236 213
  834. //C 250 249 9
  835. //D 73 65 46
  836. //F 231 77, 62
  837.  
  838.  
  839.  
  840.  
  841.     if (student.commentQ == 55)
  842.     {
  843.         ctx.fillStyle = "rgb(231,77,62)";
  844.     }
  845.     else if (student.commentQ == 65) {
  846.         ctx.fillStyle = "rgb(73, 65, 46)";
  847.     }
  848.     else if (student.commentQ == 75) {
  849.         ctx.fillStyle = "rgb(250, 249, 9)";
  850.     }
  851.     else if (student.commentQ == 85) {
  852.         ctx.fillStyle = "rgb(54, 236, 213)";
  853.     }
  854.     else if (student.commentQ == 95) {
  855.         ctx.fillStyle = "rgb(57, 191, 69)";
  856.     }
  857.  
  858.     ctx.fillStyle = "rgb(0, 0, 0)";
  859.  
  860.  
  861.     // ctx.fillStyle = "rgb(57,191, 69)";
  862.     ctx.font = "15px Lucida Console";
  863.     ctx.textAlign = "left";
  864.     ctx.textBaseline = "top";
  865.     ctx.fillText(student.comment,textPos.x,textPos.y);
  866.  
  867.  
  868.  
  869.  
  870.  
  871.     if (student.onlineCommentQ == 55)
  872.     {
  873.         ctx.fillStyle = "rgb(231,77,62)";
  874.     }
  875.     else if (student.onlineCommentQ == 65) {
  876.         ctx.fillStyle = "rgb(73, 65, 46)";
  877.     }
  878.     else if (student.onlineCommentQ== 75) {
  879.         ctx.fillStyle = "rgb(250, 249, 9)";
  880.     }
  881.     else if (student.onlineCommentQ == 85) {
  882.         ctx.fillStyle = "rgb(54, 236, 213)";
  883.     }
  884.     else if (student.onlineCommentQ == 95) {
  885.         ctx.fillStyle = "rgb(57, 191, 69)";
  886.     }
  887.  
  888.     ctx.fillStyle = "rgb(0, 0, 0)";
  889.  
  890.     //online
  891.     //ctx.fillStyle = "rgb(57,191, 69)";
  892.     ctx.font = "15px Lucida Console";
  893.     ctx.textAlign = "left";
  894.     ctx.textBaseline = "top";
  895.     ctx.fillText(student.onlineComment,onlinePos.x,onlinePos.y);
  896.  
  897.  
  898.     if (student.interactionQ == 55)
  899.     {
  900.         ctx.fillStyle = "rgb(231,77,62)";
  901.     }
  902.     else if (student.interactionQ == 65) {
  903.         ctx.fillStyle = "rgb(73, 65, 46)";
  904.     }
  905.     else if (student.interactionQ == 75) {
  906.         ctx.fillStyle = "rgb(250, 249, 9)";
  907.     }
  908.     else if (student.interactionQ == 85) {
  909.         ctx.fillStyle = "rgb(54, 236, 213)";
  910.     }
  911.     else if (student.interactionQ == 95) {
  912.         ctx.fillStyle = "rgb(57, 191, 69)";
  913.     }
  914.  
  915.     ctx.fillStyle = "rgb(0, 0, 0)";
  916.  
  917.     //interactions
  918.     // ctx.fillStyle = "rgb(57,191, 69)";
  919.     ctx.font = "15px Lucida Console";
  920.     ctx.textAlign = "left";
  921.     ctx.textBaseline = "top";
  922.     ctx.fillText(student.interaction,interactionPos.x,interactionPos.y);
  923.  
  924.     //bad meter text
  925.     ctx.fillStyle = "rgb(0,0, 0)";
  926.     ctx.font = "15px Lucida Console";
  927.     ctx.textAlign = "left";
  928.     ctx.textBaseline = "top";
  929.     ctx.fillText("Bad meter: " , 190,540);
  930.  
  931.     //student name text box
  932.  
  933.     ctx.fillStyle = "rgb(0,0, 0)";
  934.     ctx.font = "15px Lucida Console";
  935.     ctx.textAlign = "left";
  936.     ctx.textBaseline = "top";
  937.     ctx.fillText(student.fName + " " + student.lName, studentPos.x,studentPos.y);
  938.  
  939.  
  940.     //number semester text
  941.     ctx.fillStyle = "rgb(0,0, 0)";
  942.     ctx.font = "15px Lucida Console";
  943.     ctx.textAlign = "left";
  944.     ctx.textBaseline = "top";
  945.     ctx.fillText(semesterOn, semesterPos.x,semesterPos.y);
  946.  
  947. };
  948.  
  949.  
  950.  
  951. var updateEnd = function() {
  952.     //look for spacebar (32), if space bar pressed, restart the game
  953.     if (32 in keysDown) {
  954.         gameGo();
  955.     }
  956.  
  957. }
  958.  
  959. var renderEnd = function() {
  960.  
  961.     //clear screen
  962.     if (bgReady) {
  963.         ctx.drawImage(bgImage, 0, 0);
  964.     }
  965.  
  966.     if (firedReady) {
  967.         ctx.drawImage(firedImage, 257,250);
  968.     }
  969.  
  970.     if (playReady) {
  971.         ctx.drawImage(playImage, 260,315);
  972.     }
  973.  
  974. }
  975.  
  976.  
  977. var updateStart = function () {
  978.     if (32 in keysDown) {
  979.         gameGoS();
  980.     }
  981. }
  982.  
  983. var renderStart = function() {
  984.  
  985.     //clear screen
  986.     if (bgReady) {
  987.         ctx.drawImage(bgImage, 0, 0);
  988.     }
  989.  
  990.     if (titleReady) {
  991.         ctx.drawImage(titleImage, 255, 200);
  992.     }
  993.  
  994.     if (howReady) {
  995.         ctx.drawImage(howImage, 265, 250);
  996.     }
  997.  
  998.     if (theTextReady){
  999.         ctx.drawImage(theTextImage, 240, 230);
  1000.     }
  1001.  
  1002.     if (playFReady) {
  1003.         ctx.drawImage(playFImage, 260,550);
  1004.     }
  1005. }
  1006.  
  1007. //main game loop
  1008. var main = function () {
  1009.     var now = Date.now();
  1010.     var delta = now - then;
  1011.  
  1012.     if (gameState == "play"){
  1013.         update(delta / 1000); //call to update
  1014.         render();  //call to render
  1015.     }
  1016.     //update and render the end screen
  1017.     else if (gameState == "end") {
  1018.         updateEnd(); //call to update
  1019.         renderEnd();  //call to render
  1020.     }
  1021.     else if (gameState == "start") {
  1022.         updateStart(); //call to update
  1023.         renderStart();  //call to render
  1024.     }
  1025.  
  1026.  
  1027.     then = now;
  1028.  
  1029.     // Request to do this again ASAP
  1030.     requestAnimationFrame(main);
  1031. };
  1032.  
  1033.  
  1034. // Cross-browser support for requestAnimationFrame
  1035. var w = window;
  1036. requestAnimationFrame = w.requestAnimationFrame || w.webkitRequestAnimationFrame || w.msRequestAnimationFrame || w.mozRequestAnimationFrame;
  1037.  
  1038. //start the game
  1039. // Let's play this game!
  1040. var then = Date.now();
  1041. reset();
  1042. gameGo();
  1043. main();
RAW Paste Data