A collection of games I worked on in high school.
at main 708 lines 24 kB view raw
1(function () { 2 'use strict'; 3 4 function Boot() {} 5 6 Boot.prototype = { 7 preload: function () { 8 this.load.image('preloader', 'assets/preloader.gif'); 9 }, 10 11 create: function () { 12 // configure game 13 this.game.input.maxPointers = 1; 14 15 if (this.game.device.desktop) { 16 this.game.scale.pageAlignHorizontally = true; 17 } else { 18 this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; 19 this.game.scale.minWidth = 480; 20 this.game.scale.minHeight = 260; 21 this.game.scale.maxWidth = 640; 22 this.game.scale.maxHeight = 480; 23 this.game.scale.forceOrientation(true); 24 this.game.scale.pageAlignHorizontally = true; 25 this.game.scale.setScreenSize(true); 26 } 27 this.game.state.start('preloader'); 28 } 29 }; 30 31 window['s6'] = window['s6'] || {}; 32 window['s6'].Boot = Boot; 33}()); 34 35 36(function() { 37 'use strict'; 38 function Credits() {} 39 40 Credits.prototype = { 41 create: function () { 42 var credit = this.game.add.sprite(0, 0, 'creditPage'); 43 var buttonMenu = this.game.add.button(888, 530, 'back', this.startOnClick, this, 2, 1, 0); 44 buttonMenu.anchor.set(0.5); 45 }, 46 update: function () { 47 48 }, 49 50 startOnClick: function () { 51 this.game.state.start('menu'); 52 }, 53 }; 54 55 window['s6'] = window['s6'] || {}; 56 window['s6'].Credits = Credits; 57}()); 58/* global Phaser */ 59(function() { 60 'use strict'; 61 62 function Game() {} 63 64 var player; 65 var playerState = "walking"; 66 var actorDir = {left: 1, right: -1}; 67 var currPlayerDir = actorDir.left; 68 var hidingPlayerTheatre = 0; 69 var floor; 70 var theatres; 71 var floorLine; 72 var hidingPlayerY; 73 var walkingPlayerY; 74 var cursors; 75 var throwKey; 76 var playerMark; 77 var markLoc; 78 var enemies = []; 79 80 var TheatreParts = {LWALL: 0, UWALL: 1, WELL: 2, SCREEN: 3}; 81 82 // Global Vars 83 var MOVEMENT_SPEED = 5; 84 var TOTAL_THEATRES = 6; 85 var THEATRE_WIDTH = 474; 86 var TOTAL_ENEMIES = Math.round(TOTAL_THEATRES / 3); 87 var ENEMY_RANGE = 500; 88 var MAX_FACE = 3; 89 var MAX_ENMH = 5; 90 var worldWidth = TOTAL_THEATRES * THEATRE_WIDTH; 91 var currentTheatrePosX = 0; 92 93 var TheatreManager = { 94 theatres: [], 95 create: function(y, context) { 96 for (var i = 0; i < TOTAL_THEATRES; i++) { 97 this.theatres[i] = Theatre.create(y, context); 98 currentTheatrePosX += THEATRE_WIDTH; 99 } 100 return this; 101 }, 102 getParts: function(part) { 103 var arr = []; 104 for (var i = 0; i < TOTAL_THEATRES; i++) 105 arr[i] = this.theatres[i]._[part]; 106 return arr; 107 }, 108 } 109 110 var Theatre = { 111 create: function(y, context) { 112 var x = currentTheatrePosX + THEATRE_WIDTH / 2; 113 var ret = { 114 _: [context.game.add.sprite(currentTheatrePosX, y, 'lwall'), context.game.add.sprite(currentTheatrePosX, y, 'uwall'), context.game.add.sprite(x, y, 'well'), context.game.add.sprite(currentTheatrePosX, y, 'screen')], 115 } 116 this.setup(ret, context); 117 return ret; 118 }, 119 setup: function (obj, context) { 120 // Lower Wall 121 obj._[0].scale.set(.5); 122 obj._[0].anchor.set(0, 1); 123 124 // Upper Wall 125 obj._[1].anchor.set(0, 1); 126 obj._[1].scale.set(.5); 127 128 // Well 129 obj._[2].scale.set(.5); 130 obj._[2].anchor.set(.5, 1); 131 obj._[2].tint = 0xd0d0d0; 132 context.game.physics.arcade.enable(obj._[1]); 133 134 // Screen 135 obj._[3].scale.set(.5); 136 obj._[3].anchor.set(0, 1); 137 } 138 } 139 140 var FaceManager = { 141 create: function(x, y, context) { 142 var baseColor = Math.floor(Math.random() * MAX_FACE); 143 var faceGroup = context.game.add.sprite(x, y, 'popup'); 144 145 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'back' + Math.floor(Math.random() * MAX_ENMH))); 146 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'ears' + baseColor + Math.round(Math.random()))); 147 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'face' + baseColor)); 148 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'front' + Math.floor(Math.random() * MAX_ENMH))); 149 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'eyes' + Math.floor(Math.random() * MAX_ENMH))); 150 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'nose' + Math.floor(Math.random() * MAX_ENMH))); 151 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'mouth' + Math.floor(Math.random() * MAX_ENMH))); 152 faceGroup.visible = false; 153 faceGroup.anchor.set(.5, 1); 154 faceGroup.scale.set(.25); 155 return faceGroup; 156 }, 157 fromArr(arr, x, y, context) { 158 var faceGroup = context.game.add.sprite(x, y, 'popup'); 159 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'back' + arr[0])); 160 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'ears' + arr[1])); 161 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'face' + arr[2])); 162 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'front' + arr[3])); 163 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'eyes' + arr[4])); 164 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'nose' + arr[5])); 165 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'mouth' + arr[6])); 166 faceGroup.visible = false; 167 faceGroup.anchor.set(.5, 1); 168 faceGroup.scale.set(.25); 169 return faceGroup; 170 } 171 } 172 173 174 Game.prototype = { 175 init: function(mark) { 176 playerMark = mark; 177 markLoc = Math.floor(Math.random() * TOTAL_THEATRES); 178 }, 179 create: function () { 180 currentTheatrePosX = 0; 181 playerState = "walking"; 182 this.game.world.setBounds(0, 0, worldWidth, 600); 183 184 floorLine = 472; 185 hidingPlayerY = floorLine - 20; 186 walkingPlayerY = floorLine + 40; 187 188 theatres = TheatreManager.create(floorLine, this); 189 190 floor = this.game.add.physicsGroup(); 191 for (var i = 0; i < worldWidth; i += 1024) 192 floor.create(i, floorLine, 'floor'); 193 floor.setAll('tint', 0xd0d0d0); 194 195 player = this.game.add.sprite(100, walkingPlayerY, 'player'); 196 player.anchor.set(0.5, 0.5); 197 this.game.physics.arcade.enable(player); 198 player.body.collideWorldBounds = true; 199 this.game.camera.follow(player, Phaser.Camera.FOLLOW_TOPDOWN); 200 201 for (var i = 0; i < TOTAL_ENEMIES; i++) { 202 var locX = Math.floor(Math.random() * (worldWidth - 1100)) + 600; 203 enemies[i] = { 204 e: this.game.add.sprite(locX, walkingPlayerY, 'enemy'), 205 dir: (Math.round(Math.random()) === 0) ? actorDir.left : actorDir.right, 206 startX: locX, 207 max: locX + ENEMY_RANGE, 208 min: locX - ENEMY_RANGE, 209 speed: MOVEMENT_SPEED - 4 210 }; 211 enemies[i].e.anchor.set(0.5, 0.5); 212 enemies[i].e.scale.set(.25); 213 this.game.physics.arcade.enable(enemies[i].e); 214 enemies[i].e.body.collideWorldBounds = true; 215 } 216 217 for (var i = 0; i < TOTAL_THEATRES; i++) { 218 theatres.theatres[i].em = this.game.add.emitter((i * THEATRE_WIDTH) + THEATRE_WIDTH / 2, 200, 200); 219 // Particle settings 220 theatres.theatres[i].em.makeParticles(['smoke1', 'smoke2', 'smoke3']); 221 theatres.theatres[i].em.minParticleScale = .3; 222 theatres.theatres[i].em.maxParticleScale = .3; 223 theatres.theatres[i].em.particleBringToTop = false; 224 225 if (i === markLoc) { 226 theatres.theatres[i].face = FaceManager.fromArr(playerMark, (i * THEATRE_WIDTH) + THEATRE_WIDTH / 2, 300, this); 227 theatres.theatres[i].face.visible = false; 228 theatres.theatres[i].face.anchor.set(.5, 1); 229 theatres.theatres[i].face.scale.set(.25); 230 } 231 else 232 theatres.theatres[i].face = FaceManager.create((i * THEATRE_WIDTH) + THEATRE_WIDTH / 2, 300, this); 233 } 234 235 this.input.keyboard.addKey(Phaser.Keyboard.UP); 236 cursors = this.game.input.keyboard.createCursorKeys(); 237 throwKey = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); 238 }, 239 240 update: function () { 241 242 for (var i = 0; i < TOTAL_ENEMIES; i++) { 243 if (enemies[i].e.x >= enemies[i].max || enemies[i].e.x <= enemies[i].min) { 244 if (enemies[i].e.x >= enemies[i].max) { 245 enemies[i].dir = actorDir.left; 246 enemies[i].e.x -= enemies[i].speed; 247 } 248 else if (enemies[i].e.x <= enemies[i].min) { 249 enemies[i].dir = actorDir.right; 250 enemies[i].e.x += enemies[i].speed; 251 } 252 } 253 else 254 if (enemies[i].dir == actorDir.right) 255 enemies[i].e.x += enemies[i].speed; 256 else if (enemies[i].dir == actorDir.left) { 257 enemies[i].e.x -= enemies[i].speed; 258 } 259 if (enemies[i].dir == actorDir.right) 260 enemies[i].e.scale.x = -.25; 261 else 262 enemies[i].e.scale.x = .25; 263 264 var min = player.x + (player.width * currPlayerDir) / 2 > (enemies[i].e.x - (enemies[i].e.width * enemies[i].dir) / 2); 265 var max = player.x - (player.width * currPlayerDir) / 2 < (enemies[i].e.x - (enemies[i].e.width * enemies[i].dir) / 2); 266 if ((min && max) && playerState !== "hiding") { 267 var context = this; 268 function seen() { 269 context.game.paused = false; 270 context.game.state.start('winLose', true, false, "were seen"); 271 } 272 this.game.paused = true; 273 window.setTimeout(seen, 1000); 274 } 275 } 276 277 if (playerState === "walking") { 278 var wells = theatres.getParts(TheatreParts.WELL); 279 280 for (var i = 0; i < TOTAL_THEATRES; i++) { 281 var wellXMin = (player.x - (player.width * currPlayerDir) / 2 > wells[i].x - wells[i].width / 2); 282 var wellXMax = (player.x + (player.width * currPlayerDir) / 2 < (wells[i].x + wells[i].width / 2)); 283 if ((wellXMin && wellXMax) && player.y <= hidingPlayerY + 10) { 284 playerState = "hiding"; 285 hidingPlayerTheatre = i; 286 break; 287 } 288 } 289 290 if (cursors.left.isDown && player.y === walkingPlayerY) { 291 player.x -= MOVEMENT_SPEED; 292 player.scale.x = 1; 293 currPlayerDir = actorDir.left; 294 } 295 else if (cursors.right.isDown && player.y === walkingPlayerY) { 296 player.x += MOVEMENT_SPEED; 297 player.scale.x = -1; 298 currPlayerDir = actorDir.right; 299 } 300 301 player.tint = 0xffffff; 302 } 303 else if (playerState === "hiding") { 304 player.tint = 0x747474; 305 if (throwKey.isDown && playerState === "hiding") { 306 theatres.theatres[hidingPlayerTheatre].em.start(false, 5000, 20); 307 var that = this; 308 if (hidingPlayerTheatre !== markLoc) { 309 theatres.theatres[hidingPlayerTheatre].face.tint = 0xff4c4c; 310 function lose() { 311 that.game.state.start('winLose', true, false, "lose"); 312 } 313 window.setTimeout(lose, 2500); 314 } 315 else { 316 theatres.theatres[hidingPlayerTheatre].face.tint = 0x4cff4c; 317 function win() { 318 that.game.state.start('winLose', true, false, "win"); 319 } 320 window.setTimeout(win, 2500); 321 } 322 playerState = "smoking"; 323 } 324 theatres.theatres[hidingPlayerTheatre].face.visible = true; 325 } 326 else if (playerState === "moving") { 327 player.tint = 0xffffff; 328 } 329 330 this.game.input.keyboard.onDownCallback = function( e ){ 331 if (e.keyCode === Phaser.Keyboard.UP) { 332 this.game.add.tween(player).to( { x: player.x, y: hidingPlayerY }, 100 * MOVEMENT_SPEED, "Cubic", true); 333 } 334 }; 335 336 function back2Walking() { 337 playerState = "walking"; 338 theatres.theatres[hidingPlayerTheatre].face.visible = false; 339 } 340 341 this.game.input.keyboard.onUpCallback = function( e ){ 342 if(e.keyCode === Phaser.Keyboard.UP) { 343 if (playerState !== "smoking") { 344 var tween = this.game.add.tween(player); 345 tween.to( { x: player.x, y: walkingPlayerY }, 125 * MOVEMENT_SPEED, "Cubic", true); 346 tween.onComplete.add(back2Walking, this); 347 playerState = "moving"; 348 } 349 } 350 }; 351 } 352 }; 353 354 window['s6'] = window['s6'] || {}; 355 window['s6'].Game = Game; 356}()); 357 358/* global Phaser */ 359window.addEventListener('load', function () { 360 'use strict'; 361 362 var ns = window['s6']; 363 var game = new Phaser.Game(1024, 600, Phaser.AUTO, 's6-game'); 364 game.state.add('boot', ns.Boot); 365 game.state.add('preloader', ns.Preloader); 366 game.state.add('menu', ns.Menu); 367 game.state.add('mark', ns.Mark); 368 game.state.add('game', ns.Game); 369 game.state.add('winLose', ns.WinLose); 370 game.state.add('credits', ns.Credits); 371 /* yo phaser:state new-state-files-put-here */ 372 game.state.start('boot'); 373}, false); 374 375(function() { 376 'use strict'; 377 function Mark() {} 378 379 var playerMark; 380 var MAX_FACE = 3; 381 var MAX_ENMH = 5; 382 var makeMark = function(x, y, context) { 383 var baseColor = Math.floor(Math.random() * MAX_FACE); 384 var faceGroup = context.game.add.sprite(x, y, 'popup'); 385 var stuff = [ Math.floor(Math.random() * MAX_ENMH), baseColor.toString() + Math.round(Math.random()), baseColor, Math.floor(Math.random() * MAX_ENMH), Math.floor(Math.random() * MAX_ENMH), Math.floor(Math.random() * MAX_ENMH), Math.floor(Math.random() * MAX_ENMH) ]; 386 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'back' + stuff[0])); 387 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'ears' + stuff[1])); 388 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'face' + stuff[2])); 389 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'front' + stuff[3])); 390 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'eyes' + stuff[4])); 391 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'nose' + stuff[5])); 392 faceGroup.addChild(context.game.make.sprite(0 - faceGroup.width / 2, 0 - faceGroup.height - 100, 'mouth' + stuff[6])); 393 faceGroup.visible = false; 394 faceGroup.anchor.set(.5, 1); 395 faceGroup.scale.set(.25); 396 return stuff; 397 } 398 399 var descriptions = { 400 "eyes0": ["bored", "tired"], 401 "eyes1": ["angry", "unhappy"], 402 "eyes2": ["calm", "neutral"], 403 "eyes3": ["very cheerful", "very content"], 404 "eyes4": ["melancholy", "sorry"], 405 "eyes5": ["suspicious", "cautious"], 406 "nose0": ["cute", "dainty"], 407 "nose1": ["pointy", "wisdomatic"], 408 "nose2": ["average", "plain"], 409 "nose3": ["sharp", "chiseled"], 410 "nose4": ["round", "nubby"], 411 "nose5": ["strong", "powerful"], 412 "mouth0": ["indifferent", "disinterested"], 413 "mouth1": ["uptight", "bitter"], 414 "mouth2": ["satisfied", "alright"], 415 "mouth3": ["happy", "smiling"], 416 "mouth4": ["unhappy", "sad"], 417 "mouth5": ["worried", "distressed"], 418 "front0": ["brown", "straight"], 419 "front1": ["dark", "sideburned"], 420 "front2": ["prim", "brown"], 421 "front3": ["black", "curly"], 422 "front4": ["brown", "curly"], 423 "front5": ["blond", "spiky"], 424 "back0": ["long", "straight"], 425 "back1": ["long", "dark"], 426 "back2": ["long", "brown"], 427 "back3": ["no", "no"], 428 "back4": ["no", "no"], 429 "back5": ["short", "light"], 430 "ears00": ["average", "light"], 431 "ears01": ["big", "light"], 432 "ears10": ["average", "dark"], 433 "ears11": ["big", "dark"], 434 "ears20": ["average", "tan"], 435 "ears21": ["big", "tan"], 436 "face0": ["fair", "pasty"], 437 "face1": ["dark", "brown"], 438 "face2": ["tan", "amber"] 439 } 440 441 Mark.prototype = { 442 create: function () { 443 var buttonStart = this.game.add.button(924, 530, 'ready', this.startOnClick, this, 2, 1, 0); 444 buttonStart.anchor.set(0.5); 445 446 var titleStyle = { font: "bold 64px Calibri", fill: "#fff", align: "center" }; 447 var title = this.game.add.text(230, 90, 'Your target...', titleStyle); 448 title.anchor.set(0.5); 449 playerMark = makeMark(512, 740, this); 450 451 var descriptionStyle = { font: "bold 48px Calibri", fill: "#fff", align: "center", wordWrap: true, wordWrapWidth: 800 }; 452 var description = "will stare at you with " + descriptions["eyes" + playerMark[4]][Math.round(Math.random())] + " eyes. " + 453 "Their nose is " + descriptions["nose" + playerMark[5]][Math.round(Math.random())] + ". " + 454 "Their mouth curls in a(n) " + descriptions["mouth" + playerMark[6]][Math.round(Math.random())] + " way. " + 455 "They have " + descriptions["front" + playerMark[3]][Math.round(Math.random())] + " hair on top " + 456 "and " + descriptions["back" + playerMark[0]][Math.round(Math.random())] + " hair in back. " + 457 "Your target has a(n) " + descriptions["face" + playerMark[2]][Math.round(Math.random())] + " face " + 458 "and " + descriptions["ears" + playerMark[1]][Math.round(Math.random())] + " ears. " + 459 "Good luck!"; 460 var text = this.game.add.text(512, 300, description, descriptionStyle); 461 text.anchor.set(0.5); 462 }, 463 update: function () { 464 465 }, 466 467 startOnClick: function () { 468 this.game.state.start('game', true, false, playerMark); 469 }, 470 }; 471 472 window['s6'] = window['s6'] || {}; 473 window['s6'].Mark = Mark; 474}()); 475(function() { 476 'use strict'; 477 478 function Menu() {} 479 480 Menu.prototype = { 481 create: function () { 482 var buttonStart = this.game.add.button(384, 483 428, 484 'start', 485 this.startOnClick, 486 this, 487 2, 1, 0); 488 var buttonCredits = this.game.add.button(640, 489 428, 490 'credits', 491 this.actionOnClick, 492 this, 493 2, 1, 0); 494 buttonStart.anchor.set(0.5); 495 buttonCredits.anchor.set(0.5); 496 497 var style = { font: "bold 64px Calibri", fill: "#fff", align: "center" }; 498 var title = this.game.add.text(512, 499 204, 500 'SNEAKILY SLINGING\nSLIGHTLY SULFUROUS-SMELLING\nSMOKE\n(or S6, for short)', 501 style); 502 503 title.anchor.set(0.5); 504 505 title.addColor("#FF4C4C", 0); 506 title.addColor("#FFFFFF", 1); 507 title.addColor("#FF4C4C", 9); 508 title.addColor("#FFFFFF", 10); 509 title.addColor("#FF4C4C", 17); 510 title.addColor("#FFFFFF", 18); 511 title.addColor("#FF4C4C", 26); 512 title.addColor("#FFFFFF", 27); 513 title.addColor("#FF4C4C", 36); 514 title.addColor("#FFFFFF", 37); 515 title.addColor("#FF4C4C", 44); 516 title.addColor("#FFFFFF", 45); 517 title.addColor("#4C4CFF", 52); 518 title.addColor("#FFFFFF", 55); 519 520 }, 521 522 update: function () { 523 524 }, 525 526 startOnClick: function () { 527 this.game.state.start('mark'); 528 }, 529 actionOnClick: function () { 530 this.game.state.start('credits'); 531 }, 532 533 }; 534 535 window['s6'] = window['s6'] || {}; 536 window['s6'].Menu = Menu; 537}()); 538 539(function() { 540 'use strict'; 541 542 function Preloader() { 543 this.asset = null; 544 this.ready = false; 545 } 546 547 Preloader.prototype = { 548 preload: function () { 549 this.asset = this.add.sprite(this.game.width * 0.5 - 110, this.game.height * 0.5 - 10, 'preloader'); 550 this.load.setPreloadSprite(this.asset); 551 552 // this.load.onLoadComplete.addOnce(this.onLoadComplete, this); 553 this.loadResources(); 554 555 this.ready = true; 556 }, 557 558 loadResources: function () { 559 // load your assets here 560 this.game.stage.backgroundColor = '#85b5e1'; 561 562 this.game.load.baseURL = './assets/'; 563 this.game.load.crossOrigin = 'anonymous'; 564 565 // ----- Menu ----- 566 this.game.load.image('credits', 'CreditsButton.png'); 567 this.game.load.image('start', 'StartButton.png'); 568 569 // ----- Mark ----- 570 this.game.load.image('ready', "ReadyButton.png"); 571 572 // ----- WinLose ----- 573 this.game.load.image("restart", "RestartButton.png"); 574 575 // ----- Credits ----- 576 this.game.load.image("back", "BackButton.png"); 577 578 // ----- Background ----- 579 this.game.load.image('well', 'backgrounds/well.png'); 580 this.game.load.image('screen', 'backgrounds/screen.png'); 581 582 this.game.load.image('lwall', 'backgrounds/lower_wall.png'); 583 this.game.load.image('uwall', 'backgrounds/upper_wall.png'); 584 this.game.load.image('floor', 'backgrounds/floor.png'); 585 586 // ----- Smoke ----- 587 this.game.load.image('smoke1', 'effects/smoke1.png'); 588 this.game.load.image('smoke2', 'effects/smoke2.png'); 589 this.game.load.image('smoke3', 'effects/smoke3.png'); 590 591 // ----- Actors ----- 592 this.game.load.image('player', 'kenny/Characters/Hedgehog/hedgehog_body.png'); 593 this.game.load.image('enemy', 'MrBoo.png'); 594 595 // ----- Credits ----- 596 this.game.load.image('creditPage', 'CreditsPage.png'); 597 598 // ----- Face Stuff ----- 599 // Popup 600 this.game.load.image('popup', 'popup.png'); 601 602 // Eyes 603 this.game.load.image('eyes0', 'parts/bored_eyes.png'); 604 this.game.load.image('eyes1', 'parts/mad_eyes.png'); 605 this.game.load.image('eyes2', 'parts/normal_eyes.png'); 606 this.game.load.image('eyes3', 'parts/pleased_eyes.png'); 607 this.game.load.image('eyes4', 'parts/sad_eyes.png'); 608 this.game.load.image('eyes5', 'parts/suspicious_eyes.png'); 609 610 // Nose 611 this.game.load.image('nose0', 'parts/cute_nose.png'); 612 this.game.load.image('nose1', 'parts/long_nose.png'); 613 this.game.load.image('nose2', 'parts/normal_nose.png'); 614 this.game.load.image('nose3', 'parts/pointy_nose.png'); 615 this.game.load.image('nose4', 'parts/squat_nose.png'); 616 this.game.load.image('nose5', 'parts/strong_nose.png'); 617 618 // Mouth 619 this.game.load.image('mouth0', 'parts/bored_mouth.png'); 620 this.game.load.image('mouth1', 'parts/mad_mouth.png'); 621 this.game.load.image('mouth2', 'parts/normal_mouth.png'); 622 this.game.load.image('mouth3', 'parts/pleased_mouth.png'); 623 this.game.load.image('mouth4', 'parts/sad_mouth.png'); 624 this.game.load.image('mouth5', 'parts/worried_mouth.png'); 625 626 // Front hair 627 this.game.load.image('front0', 'parts/normal_hair_fore.png'); 628 this.game.load.image('front1', 'parts/black_girl_fore.png'); 629 this.game.load.image('front2', 'parts/prim_hair_fore.png'); 630 this.game.load.image('front3', 'parts/boy_black_hair_fore.png'); 631 this.game.load.image('front4', 'parts/boybrown_curly_hair_fore.png'); 632 this.game.load.image('front5', 'parts/spiky_blond_boy.png'); 633 634 // Back hair 635 this.game.load.image('back0', 'parts/girl_hair_back.png'); 636 this.game.load.image('back1', 'parts/black_girl_back.png'); 637 this.game.load.image('back2', 'parts/prim_girl_hair_back.png'); 638 this.game.load.image('back3', 'parts/boy_back_hair_prim.png'); 639 this.game.load.image('back4', 'parts/boy_back_hair_black.png'); 640 this.game.load.image('back5', 'parts/blonde_boy_back.png'); 641 642 // Ears 643 this.game.load.image('ears00', 'parts/white_ears_med.png'); 644 this.game.load.image('ears01', 'parts/white_ears_big.png'); 645 this.game.load.image('ears10', 'parts/brown_ears_med.png'); 646 this.game.load.image('ears11', 'parts/brown_ears_big.png'); 647 this.game.load.image('ears20', 'parts/tan_ears_med.png'); 648 this.game.load.image('ears21', 'parts/tan_ears_big.png'); 649 650 // Face 651 this.game.load.image('face0', 'parts/facebase_white.png'); 652 this.game.load.image('face1', 'parts/facebase_brown.png'); 653 this.game.load.image('face2', 'parts/facebase_tan.png'); 654 }, 655 656 create: function () { 657 658 }, 659 660 update: function () { 661 // if (!!this.ready) { 662 this.game.state.start('menu'); 663 // } 664 }, 665 666 onLoadComplete: function () { 667 // this.ready = true; 668 } 669 }; 670 671 window['s6'] = window['s6'] || {}; 672 window['s6'].Preloader = Preloader; 673}()); 674 675(function() { 676 'use strict'; 677 function WinLose() {} 678 679 var winlose; 680 681 WinLose.prototype = { 682 init: function(wl) { 683 winlose = wl; 684 }, 685 create: function () { 686 var style = { font: "bold 64px Calibri", fill: "#fff", align: "center" }; 687 var text = "You " + winlose + "!" 688 var title = this.game.add.text(512, 300, text, style); 689 title.anchor.set(0.5); 690 if (winlose === "win") 691 title.addColor("#4CFF4C", 0); 692 else title.addColor("#FF4C4C", 0); 693 694 var buttonLose = this.game.add.button(888, 530, 'restart', this.startOnClick, this, 2, 1, 0); 695 buttonLose.anchor.set(0.5); 696 }, 697 update: function () { 698 699 }, 700 701 startOnClick: function () { 702 this.game.state.start('credits'); 703 }, 704 }; 705 706 window['s6'] = window['s6'] || {}; 707 window['s6'].WinLose = WinLose; 708}());