├── .gitignore ├── assets ├── js │ ├── Render.js │ ├── Autoload.js │ ├── app.js │ ├── Config.js │ ├── Create.js │ ├── Preload.js │ ├── Update.js │ └── Gameplay.js ├── img │ ├── cat.png │ ├── gun.png │ ├── top.png │ ├── footer.png │ ├── share.png │ ├── split.png │ ├── btn-left.png │ ├── btn-right.png │ ├── btn-start.png │ ├── split-big.png │ ├── bg-gameover.png │ ├── btn-restart.png │ ├── char-intro.png │ ├── game-title.png │ ├── split-fruit.png │ ├── split-medium.png │ └── bg-pressstart.jpg └── sound │ ├── bg.mp3 │ ├── bg.ogg │ ├── btn.mp3 │ ├── btn.ogg │ ├── cough.mp3 │ ├── cough.ogg │ ├── gameover.mp3 │ └── gameover.ogg ├── README.md ├── bower.json ├── package.json ├── LICENSE ├── Gruntfile.js └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | bower_components/ -------------------------------------------------------------------------------- /assets/js/Render.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | 3 | APP.Render = function(){ 4 | }; -------------------------------------------------------------------------------- /assets/img/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/cat.png -------------------------------------------------------------------------------- /assets/img/gun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/gun.png -------------------------------------------------------------------------------- /assets/img/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/top.png -------------------------------------------------------------------------------- /assets/sound/bg.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/bg.mp3 -------------------------------------------------------------------------------- /assets/sound/bg.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/bg.ogg -------------------------------------------------------------------------------- /assets/img/footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/footer.png -------------------------------------------------------------------------------- /assets/img/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/share.png -------------------------------------------------------------------------------- /assets/img/split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/split.png -------------------------------------------------------------------------------- /assets/sound/btn.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/btn.mp3 -------------------------------------------------------------------------------- /assets/sound/btn.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/btn.ogg -------------------------------------------------------------------------------- /assets/sound/cough.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/cough.mp3 -------------------------------------------------------------------------------- /assets/sound/cough.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/cough.ogg -------------------------------------------------------------------------------- /assets/img/btn-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/btn-left.png -------------------------------------------------------------------------------- /assets/img/btn-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/btn-right.png -------------------------------------------------------------------------------- /assets/img/btn-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/btn-start.png -------------------------------------------------------------------------------- /assets/img/split-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/split-big.png -------------------------------------------------------------------------------- /assets/img/bg-gameover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/bg-gameover.png -------------------------------------------------------------------------------- /assets/img/btn-restart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/btn-restart.png -------------------------------------------------------------------------------- /assets/img/char-intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/char-intro.png -------------------------------------------------------------------------------- /assets/img/game-title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/game-title.png -------------------------------------------------------------------------------- /assets/img/split-fruit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/split-fruit.png -------------------------------------------------------------------------------- /assets/img/split-medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/split-medium.png -------------------------------------------------------------------------------- /assets/sound/gameover.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/gameover.mp3 -------------------------------------------------------------------------------- /assets/sound/gameover.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/sound/gameover.ogg -------------------------------------------------------------------------------- /assets/img/bg-pressstart.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogilvieira/nao-cuspa-no-gato/HEAD/assets/img/bg-pressstart.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Não cuspa no gato 2 | Sobreviva a mortais cuspidas de uma youtuber que possui uma maneira peculiar de alimentar gatos 3 | 4 | # Tasks: 5 | * Adicionar sprites animados por eventos 6 | * Adicionar score gigante na tela de game over 7 | * Otimizar para aparelhos de baixo desempenho 8 | -------------------------------------------------------------------------------- /assets/js/Autoload.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | 3 | APP.Autoload = (function(Phaser){ 4 | var obj = {}; 5 | 6 | obj.init = function(){ 7 | window.GAME = window.GAME || new Phaser.Game( 640, 960, Phaser.AUTO, 'screen', 8 | { 9 | preload: APP.Preload, 10 | create: APP.Create, 11 | update: APP.Update, 12 | render: APP.Render 13 | }); 14 | }; 15 | 16 | return obj; 17 | }(Phaser)); -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nao-cuspa-no-gato", 3 | "homepage": "https://github.com/ogilvieira/nao-cuspa-no-gato", 4 | "authors": [ 5 | "Gil Vieira " 6 | ], 7 | "description": "", 8 | "main": "", 9 | "license": "MIT", 10 | "private": true, 11 | "ignore": [ 12 | "**/.*", 13 | "node_modules", 14 | "bower_components", 15 | "test", 16 | "tests" 17 | ], 18 | "dependencies": { 19 | "phaser": "^2.6.2" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /assets/js/app.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | 3 | ;(function(){ 4 | WebFontConfig = { 5 | google: { families: [ 'Press+Start+2P::latin' ] }, 6 | active: APP.Autoload.init 7 | }; 8 | (function() { 9 | var wf = document.createElement('script'); 10 | wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + 11 | '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; 12 | wf.type = 'text/javascript'; 13 | wf.async = 'true'; 14 | var s = document.getElementsByTagName('script')[0]; 15 | s.parentNode.insertBefore(wf, s); 16 | })(); 17 | }()); -------------------------------------------------------------------------------- /assets/js/Config.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | 3 | APP.Config = (function(){ 4 | var obj = {} 5 | 6 | obj.STATUS = 'INTRO'; //INTRO, PLAY, GAMEOVER 7 | obj.GAP = 32; 8 | obj.GAPDEFAULT = 32; 9 | obj.AF = 0; 10 | obj.SCORE = 0; 11 | obj.SCORESTRING = ''; 12 | obj.SCORETEXT = null; 13 | obj.CURSORS = null; 14 | 15 | obj.PLAYER = null; 16 | obj.GUN = null; 17 | obj.SPLIT = null; 18 | obj.actualPos = 2; 19 | 20 | obj.TOP = null; 21 | obj.FOOTER = null; 22 | obj.BTN = { 23 | LEFT: null, 24 | RIGHT: null 25 | }; 26 | 27 | obj.shotTypes = [ 28 | { name: 'split', power: 1 }, 29 | { name: 'split-medium', power: 2 }, 30 | { name: 'split-big', power: 3 } 31 | ]; 32 | 33 | return obj; 34 | }()); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "viihtube-survivor", 3 | "version": "1.0.0", 4 | "description": "Sobreviva a mortais cuspidas de uma youtuber que possui uma maneira peculiar de alimentar gatos", 5 | "main": "Gruntfile.js", 6 | "devDependencies": { 7 | "grunt": "^1.0.1", 8 | "grunt-contrib-uglify": "^2.0.0" 9 | "grunt-contrib-imagemin": "^1.0.1" 10 | }, 11 | "scripts": { 12 | "test": "echo \"Error: no test specified\" && exit 1" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/ogilvieira/nao-cuspa-no-gato.git" 17 | }, 18 | "author": "", 19 | "license": "MIT", 20 | "bugs": { 21 | "url": "https://github.com/ogilvieira/nao-cuspa-no-gato/issues" 22 | }, 23 | "homepage": "https://github.com/ogilvieira/nao-cuspa-no-gato#readme" 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Gil Vieira 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /assets/js/Create.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | var bgSong, 3 | btnSound; 4 | 5 | APP.Create = function(){ 6 | var GAME = window.GAME; 7 | 8 | GAME.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; 9 | GAME.scale.pageAlignHorizontally = true; 10 | GAME.scale.pageAlignVertically = true; 11 | GAME.scale.refresh(); 12 | 13 | spaceKey = GAME.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); 14 | 15 | bgSong = GAME.add.audio('bgsong'); 16 | btnSound = GAME.add.audio('btnSound'); 17 | gameoverSound = GAME.add.audio('gameoverSound'); 18 | coughSound = GAME.add.audio('coughSound'); 19 | coughSound.volume = .3; 20 | btnSound.volume = .1; 21 | bgSong.play(); 22 | 23 | GAME.physics.startSystem(Phaser.Physics.ARCADE); 24 | GAME.stage.backgroundColor = '#000'; 25 | 26 | APP.Config.CURSORS = GAME.input.keyboard.createCursorKeys(); 27 | 28 | var bgStart = GAME.add.sprite(0, 0, 'bg-pressstart'); 29 | var gameTitle = GAME.add.sprite(0, 15, 'game-title'); 30 | var charIntro = GAME.add.sprite(132, 313, 'char-intro'); 31 | var btnSTART = GAME.add.button(133, 799, 'btn-start', function(){ 32 | btnSound.play(); 33 | GAME.world.removeAll(); 34 | APP.Gameplay.init(function(){ 35 | APP.Config.STATUS = 'PLAY'; 36 | bgSong.stop(); 37 | }); 38 | }); 39 | 40 | 41 | 42 | }; -------------------------------------------------------------------------------- /assets/js/Preload.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | APP.Preload = function(){ 3 | var GAME = window.GAME; 4 | GAME.load.image('bg-pressstart', 'assets/img/bg-pressstart.jpg'); 5 | GAME.load.image('game-title', 'assets/img/game-title.png'); 6 | GAME.load.image('char-intro', 'assets/img/char-intro.png'); 7 | GAME.load.image('btn-start', 'assets/img/btn-start.png'); 8 | 9 | GAME.load.image('bg-gameover', 'assets/img/bg-gameover.png'); 10 | GAME.load.image('btn-restart', 'assets/img/btn-restart.png'); 11 | 12 | GAME.load.image('top', 'assets/img/top.png'); 13 | GAME.load.image('cat', 'assets/img/cat.png'); 14 | GAME.load.image('gun', 'assets/img/gun.png'); 15 | GAME.load.image('btn-left', 'assets/img/btn-left.png'); 16 | GAME.load.image('btn-right', 'assets/img/btn-right.png'); 17 | GAME.load.image('split', 'assets/img/split.png'); 18 | GAME.load.image('split-medium', 'assets/img/split-medium.png'); 19 | GAME.load.image('split-big', 'assets/img/split-big.png'); 20 | GAME.load.image('split-fruit', 'assets/img/split-fruit.png'); 21 | 22 | GAME.load.audio('bgsong', ['assets/sound/bg.mp3', 'assets/sound/bg.ogg']); 23 | GAME.load.audio('btnSound', ['assets/sound/btn.mp3', 'assets/sound/btn.ogg']); 24 | GAME.load.audio('gameoverSound', ['assets/sound/gameover.mp3', 'assets/sound/gameover.ogg']); 25 | GAME.load.audio('coughSound', ['assets/sound/cough.mp3', 'assets/sound/cough.ogg']); 26 | }; -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | var javascript = [ 4 | 'bower_components/phaser/build/phaser.js', 5 | 'assets/js/Config.js', 6 | 'assets/js/Autoload.js', 7 | 'assets/js/Gameplay.js', 8 | 'assets/js/Preload.js', 9 | 'assets/js/Create.js', 10 | 'assets/js/Update.js', 11 | 'assets/js/app.js' 12 | ]; 13 | 14 | // Project configuration. 15 | grunt.initConfig({ 16 | pkg: grunt.file.readJSON('package.json'), 17 | uglify: { 18 | options: { 19 | banner: '/*===================================================== \n' 20 | +'= <%= pkg.siteName %> \n' 21 | +'= by <%= pkg.author %> \n' 22 | +'= [LAST BUILD: <%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %>] \n' 23 | +'=====================================================*/\n' 24 | }, 25 | build: { 26 | src: javascript, 27 | dest: 'assets/js/app.min.js' 28 | }, 29 | }, 30 | imagemin: { 31 | dynamic: { 32 | files: [{ 33 | expand: true, 34 | cwd: 'assets/img/', 35 | src: ['**/*.{png,jpg,gif}'], 36 | dest: "assets/img/" 37 | }] 38 | } 39 | } 40 | }); 41 | 42 | grunt.loadNpmTasks('grunt-contrib-uglify'); 43 | grunt.loadNpmTasks('grunt-contrib-imagemin'); 44 | 45 | grunt.registerTask('default', ['uglify','imagemin']); 46 | }; 47 | -------------------------------------------------------------------------------- /assets/js/Update.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | 3 | var shotPos, 4 | shotType, 5 | splitShot; 6 | 7 | APP.Update = function(){ 8 | if(APP.Config.STATUS == 'PLAY' && APP.Config.PLAYER.isAlive) 9 | { 10 | bgGameOver.visible = false; 11 | btnRestart.visible = false; 12 | 13 | if(APP.Config.GAP > 10){ 14 | APP.Config.GAP = APP.Config.GAPDEFAULT-Math.round((APP.Config.SCORE/100)*8); 15 | } else { 16 | APP.Config.GAP = 10; 17 | } 18 | 19 | if(APP.Config.AF <= APP.Config.GAP) 20 | { 21 | APP.Config.AF++; 22 | } 23 | else 24 | { 25 | APP.Config.AF = 0; 26 | 27 | shotPos = APP.Gameplay.getShotPos(); 28 | 29 | APP.Config.GUN.body.position.x = shotPos; 30 | 31 | shotType = APP.Config.shotTypes[APP.Gameplay.getRandomInt(0, 3)] 32 | splitShot = APP.Config.SPLIT.create(shotPos+40, 180, shotType.name ); 33 | 34 | splitShot.power = shotType.power; 35 | splitShot.shotName = shotType.name; 36 | splitShot.body.collideWorldBounds = false; 37 | splitShot.body.gravity.y = 2000; 38 | splitShot.checkWorldBounds = true; 39 | splitShot.events.onOutOfBounds.add(APP.Gameplay.splitOut, this); 40 | coughSound.play(); 41 | } 42 | 43 | GAME.physics.arcade.collide(APP.Config.PLAYER, APP.Config.SPLIT, APP.Gameplay.collisionHandler, null, this); 44 | APP.Config.PLAYER.body.position.x = (APP.Config.actualPos*APP.Config.PLAYER.body.width)+20; 45 | 46 | if(APP.Config.CURSORS.left.isDown && !APP.Config.CURSORS.left.repeats) 47 | { 48 | APP.Gameplay.toLeft(); 49 | } 50 | else if (APP.Config.CURSORS.right.isDown && !APP.Config.CURSORS.right.repeats) 51 | { 52 | APP.Gameplay.toRight(); 53 | } 54 | } else if (APP.Config.STATUS == 'GAMEOVER'){ 55 | bgGameOver.visible = true; 56 | btnRestart.visible = true; 57 | if(spaceKey.isDown){ 58 | APP.Gameplay.restart(); 59 | } 60 | } 61 | }; -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | [GAME] Não Cuspa no Gato 7 | 8 | 9 | 10 | 11 | 12 | 13 | 21 | 45 | 46 | 47 |
48 | 51 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /assets/js/Gameplay.js: -------------------------------------------------------------------------------- 1 | var APP = APP || {}; 2 | 3 | APP.Gameplay = (function(Phaser){ 4 | var obj = {}; 5 | 6 | obj.collisionHandler = function(player, split) { 7 | player.body.allowGravity = false; 8 | split.destroy(true); 9 | APP.Config.PLAYER.isAlive = false; 10 | APP.Config.STATUS = 'GAMEOVER'; 11 | bgSong.play(); 12 | gameoverSound.play(); 13 | } 14 | 15 | obj.splitOut = function(split) { 16 | if(APP.Config.PLAYER.isAlive){ 17 | APP.Config.SCORE += split.power; 18 | APP.Config.SCORETEXT.text = APP.Config.SCORESTRING + APP.Config.SCORE; 19 | } 20 | } 21 | 22 | obj.getRandomInt = function(min, max) { 23 | min = Math.ceil(min); 24 | max = Math.floor(max); 25 | return Math.floor(Math.random() * (max - min)) + min; 26 | }; 27 | 28 | obj.toLeft = function(){ 29 | if(APP.Config.actualPos > 0 && APP.Config.STATUS == 'PLAY'){ 30 | APP.Config.actualPos-- 31 | btnSound.play(); 32 | } 33 | }; 34 | 35 | obj.toRight = function(){ 36 | if(APP.Config.actualPos < 4 && APP.Config.STATUS == 'PLAY'){ 37 | APP.Config.actualPos++ 38 | btnSound.play(); 39 | } 40 | }; 41 | 42 | obj.restart = function(){ 43 | APP.Config.SCORE = 0; 44 | APP.Config.SCORETEXT.text = APP.Config.SCORESTRING + APP.Config.SCORE; 45 | APP.Config.STATUS = 'PLAY'; 46 | APP.Config.PLAYER.isAlive = true; 47 | APP.Config.AF = 0; 48 | APP.Config.GAP = 32; 49 | bgSong.stop(); 50 | }; 51 | 52 | obj.getShotPos = function(){ 53 | return (APP.Gameplay.getRandomInt(0, 5)*APP.Config.PLAYER.body.width)+20 54 | } 55 | 56 | obj.init = function(callback){ 57 | GAME.world.height = 960; 58 | GAME.stage.backgroundColor = "#474747"; 59 | //Init objects 60 | APP.Config.TOP = GAME.add.sprite(0, 0, 'top'); 61 | APP.Config.PLAYER = GAME.add.sprite((APP.Config.actualPos*120)+20, GAME.world.height - 230, 'cat'); 62 | APP.Config.GUN = GAME.add.sprite((APP.Config.actualPos*120)+20, 65, 'gun'); 63 | APP.Config.SPLIT = GAME.add.group(); 64 | 65 | //Set physics 66 | GAME.physics.arcade.enable(APP.Config.PLAYER); 67 | GAME.physics.arcade.enable(APP.Config.GUN); 68 | 69 | //Set player 70 | APP.Config.PLAYER.body.collideWorldBounds = true; 71 | APP.Config.PLAYER.body.gravity.x = false; 72 | APP.Config.PLAYER.body.bounce.x = 0; 73 | APP.Config.PLAYER.body.allowGravity = false; 74 | APP.Config.PLAYER.body.immovable = true; 75 | APP.Config.PLAYER.isAlive = true; 76 | 77 | //Set gun 78 | APP.Config.GUN.body.collideWorldBounds = false; 79 | APP.Config.GUN.body.bounce.x = 0; 80 | APP.Config.GUN.body.gravity.x = 0; 81 | 82 | //Set split 83 | APP.Config.SPLIT.enableBody = true; 84 | APP.Config.SPLIT.physicsBodyType = Phaser.Physics.ARCADE; 85 | 86 | //Set buttons 87 | APP.Config.BTN.LEFT = GAME.add.button(5, GAME.world.height-105, 'btn-left', obj.toLeft, this); 88 | APP.Config.BTN.RIGHT = GAME.add.button(325, GAME.world.height-105, 'btn-right', obj.toRight, this); 89 | 90 | //Set Score 91 | APP.Config.SCORESTRING = 'SCORE '; 92 | APP.Config.SCORETEXT = GAME.add.text(20, 20, APP.Config.SCORESTRING + APP.Config.SCORE, { 93 | font: '24px Press Start 2P', 94 | fill: '#fff', 95 | wordWrap: true, 96 | backgroundColor: "#000", 97 | wordWrapWidth: 980 98 | }); 99 | APP.Config.SCORETEXT.anchor.set(0); 100 | 101 | //Set Gameover 102 | 103 | bgGameOver = GAME.add.sprite(0, 60, 'bg-gameover'); 104 | btnRestart = GAME.add.button(137, 615, 'btn-restart', obj.restart, this, 2, 3, 0); 105 | bgGameOver.visible = false; 106 | btnRestart.visible = false; 107 | 108 | callback(); 109 | }; 110 | 111 | return obj; 112 | }(Phaser)); --------------------------------------------------------------------------------