Search the Community

Showing results for tags 'start'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 9 results

  1. It seems that preventAutoStart no longer has any effect... I have babylon scene with preventAutoStart set to true but they still auto start. Anybody else having this issue?
  2. Hello! I am making a waste sorting game and when the player loses all their lives, I wish to restart the game. I click the 'RETRY' text and the state reloads, but it seems that my life and garbage sprites never reload. I am wondering if it is because they are in an array (see this.garbage = []; and this.lifeSprites = [];). I have never used game.state.start to reload a state multiple times, I have only ever used it to call a state once. If I cannot get game.state.start to reload my game, I will create a restart() method with some re-positioning code and whatnot. BUT it would be way awesome if I could figure out why this doesn't work!! Below is my code and here is a link to my game so far (my code is still mucho messy). Arrow keys to rotate on desktop. BasicGame.Game = function (game) { this.firstDrop = true; this.garbage = []; this.MAX_TRASH = 5; this.lowestTrash = null; this.lastLowestTrash = null; this.lowestTrashType = null; this.lives = 3; this.lifeSprites = []; this.gap = 500; this.MIN_GAP = 250; this.fallSpeed = 3; this.MAX_FALL_SPEED = 5.5; this.sorter = null; this.rotationSpeed = 10; this.targetRotation = null; this.isRotating = false; this.clockwise = true; this.orientation = null; this.Orientation = { NORTH: 0, EAST: -90, SOUTH: -180, WEST: 90 }; this.TrashType = { BLUE: 0, COMPOST: 1, GREY: 2, YELLOW: 3 }; this.leftKey = null; this.rightKey = null; this.gameover = false; this.score = 0; this.scoreText = null; this.highScoreText = null; this.msgText = null; this.continuePrompt = null; }; BasicGame.Game.prototype = { create: function () { this.lowestTrash = 0; this.lastLowestTrash = this.MAX_TRASH - 1; var trash; for (i = 0; i < this.MAX_TRASH; i++) { trash = this.game.add.sprite(this.game.world.centerX, -this.gap * (i + 1), 'trash'); trash.loadTexture('trash', this.rnd.integerInRange(0, this.MAX_TRASH)); trash.anchor.setTo(0.5); this.garbage.push(trash); if (i == 0) { this.lowestTrashType = trash.frame; } } var life; for (i = 0; i < this.lives; i++) { life = this.game.add.sprite(0, 0, 'life'); life.anchor.setTo(0.5); life.x = (this.game.width - (life.width / 2 + 10)) - (i * life.width); life.y = life.height - 10; this.lifeSprites.push(life); } this.sorter = this.game.add.sprite(this.game.world.centerX, this.game.height, 'sorter'); this.sorter.anchor.setTo(0.5); this.orientation = this.Orientation.NORTH; this.targetRotation = this.orientation; this.scoreText = this.add.bitmapText(25, 25, 'arialPixelated', '0', 16); this.scoreText.align = 'left'; this.highScoreText = this.add.bitmapText(25, 50, 'arialPixelated', 'BEST: ' + BasicGame.highScore, 16); this.highScoreText.align = 'left'; this.continuePrompt = new SuperBitmapText(this.game, this.game.world.centerX, this.game.world.centerY + 100, 'arialPixelated', 'RETRY', 16, 25); this.continuePrompt.anchor.setTo(0.5); this.continuePrompt.align = 'left'; this.continuePrompt.alpha = 0; this.continuePrompt.inputEnabled = false; this.msgText = this.add.bitmapText(this.game.world.centerX, this.game.world.centerY, 'arialPixelated', '', 16); this.msgText.anchor.setTo(0.5); this.msgText.align = 'center'; this.game.input.onDown.add(this.rotateSorter, this); this.game.input.onDown.add(function() {if (this.continuePrompt.isDown){this.game.state.start('Game', true, false);}}, this); this.leftKey = this.game.input.keyboard.addKey(Phaser.Keyboard.LEFT); this.rightKey = this.game.input.keyboard.addKey(Phaser.Keyboard.RIGHT); this.game.input.keyboard.addCallbacks(this, this.rotateSorter); //For mobile. Phaser.Canvas.setTouchAction(this.game.canvas, 'auto'); this.game.input.touch.preventDefault = true; }, update : function () { if (!this.gameover) { this.garbage.forEach(function(trash) { trash.y += this.fallSpeed; trash.angle += 0.25; }, this); if (this.garbage[this.lowestTrash].y > this.game.height - (this.sorter.height / 2.5)) { this.checkIfScored(); } } this.sorter.angle = Phaser.Math.snapTo(this.sorter.angle, this.rotationSpeed); if (this.sorter.angle != this.targetRotation) { this.isRotating = true; } else { this.isRotating = false; } if (this.isRotating) { if (this.clockwise) { this.sorter.angle += this.rotationSpeed; } else { this.sorter.angle -= this.rotationSpeed; } } }, resetTrash : function () { this.garbage[this.lowestTrash].y += -this.gap * (this.MAX_TRASH); this.garbage[this.lowestTrash].loadTexture('trash', this.rnd.integerInRange(0, this.MAX_TRASH)); this.lowestTrash++; if (this.lowestTrash > this.garbage.length - 1) { this.lowestTrash = 0; } this.lowestTrashType = this.garbage[this.lowestTrash].frame; }, checkIfScored : function () { if (this.lowestTrashType == this.TrashType.BLUE && this.orientation == this.Orientation.NORTH) { this.score++; if (this.gap > this.MIN_GAP) { this.gap -= 5; } else { this.gap = this.MIN_GAP; } if (this.fallSpeed < this.MAX_FALL_SPEED) { this.fallSpeed += 0.05; } else { this.fallSpeed = this.MAX_FALL_SPEED; } } else if (this.lowestTrashType == this.TrashType.COMPOST && this.orientation == this.Orientation.EAST) { this.score++; if (this.gap > this.MIN_GAP) { this.gap -= 5; } else { this.gap = this.MIN_GAP; } if (this.fallSpeed < this.MAX_FALL_SPEED) { this.fallSpeed += 0.05; } else { this.fallSpeed = this.MAX_FALL_SPEED; } } else if (this.lowestTrashType == this.TrashType.GREY && this.orientation == this.Orientation.SOUTH) { this.score++; if (this.gap > this.MIN_GAP) { this.gap -= 5; } else { this.gap = this.MIN_GAP; } if (this.fallSpeed < this.MAX_FALL_SPEED) { this.fallSpeed += 0.05; } else { this.fallSpeed = this.MAX_FALL_SPEED; } } else if (this.lowestTrashType == this.TrashType.YELLOW && this.orientation == this.Orientation.WEST) { this.score++; if (this.gap > this.MIN_GAP) { this.gap -= 5; } else { this.gap = this.MIN_GAP; } if (this.fallSpeed < this.MAX_FALL_SPEED) { this.fallSpeed += 0.05; } else { this.fallSpeed = this.MAX_FALL_SPEED; } } else { this.fallSpeed = 3; this.updateLives(); } this.resetTrash(); this.scoreText.setText(this.score); }, updateLives : function () { this.lifeSprites[this.lives - 1].loadTexture('lifeFull'); this.lives--; if (this.lives == 0) { this.gameover = true; this.msgText.setText('GAME OVER!\n' + this.score + ' responsibly disposed trashes!'); this.continuePrompt.alpha = 1; this.continuePrompt.inputEnabled = true; this.continuePrompt.input.useHandCursor = true; if (this.score > BasicGame.highScore) { BasicGame.highScore = this.score; this.highScoreText.setText('BEST: ' + BasicGame.highScore); } this.garbage.forEach(function(trash) { trash.kill(); }, this); this.game.input.onDown.remove(this.rotateSorter, this); } }, rotateSorter : function () { if (this.game.device.desktop && !this.gameover) { if (this.leftKey.isDown) { this.rotateLeft(); } else if (this.rightKey.isDown) { this.rotateRight(); } } else { if (this.input.y >= this.sorter.y - this.sorter.height) { if (this.input.x >= this.game.world.centerX) { this.rotateRight(); } else if (this.input.x < this.game.world.centerX) { this.rotateLeft(); } } } }, rotateLeft : function () { this.clockwise = true; switch (this.orientation) { case this.Orientation.NORTH: this.orientation = this.Orientation.WEST; break; case this.Orientation.EAST: this.orientation = this.Orientation.NORTH; break; case this.Orientation.SOUTH: this.orientation = this.Orientation.EAST; break; case this.Orientation.WEST: this.orientation = this.Orientation.SOUTH; break; } this.targetRotation = this.orientation; }, rotateRight : function () { this.clockwise = false; switch (this.orientation) { case this.Orientation.NORTH: this.orientation = this.Orientation.EAST; break; case this.Orientation.EAST: this.orientation = this.Orientation.SOUTH; break; case this.Orientation.SOUTH: this.orientation = this.Orientation.WEST; break; case this.Orientation.WEST: this.orientation = this.Orientation.NORTH; break; } this.targetRotation = this.orientation; } }; EDIT: My input listeners also get jacked up. I separate mobile and desktop but when the state restarts, my mobile listeners are firing when they shouldn't be because I am using desktop, not mobile.
  3. Hi, Anyone has got this error before? I got this in developer console in Internet Explorer 11 -> "Phaser.Video: Unable to start downloading video in time" when using video.changeSource. The canvas config (for IE) is: var game = new Phaser.Game(1280, 720, Phaser.CANVAS, 'gameCanvas', { preload: preload, create: create, update: update}); In Chrome it works ok, but the Phaser.Game is set to "Phaser.AUTO". I haven't found any reference to this error, it only appears in phaser source code. Thanks for any advice!
  4. Hey everyone, i am new in this forum and also new to HTML5 games industry, i posting this here cause i was kinda lost in this forum and google researches, what really made me lost are articles and posts on forums which are out of dated, and things probably changed since then. i am a game developper since a while now and i have already made several cool games using game engines , which export to HTML of course after some code adjusting, and now i want to know how can i find offers or who to contact to publish my games on revenu sharing websites, or maybe even sell a non-exclusive version to some websites. i will show you guys some screenshots of my games, and tell me if my level is good enough for the market, and whats the next step i must do: Thanks for the help
  5. tl;dr: 1. After copying a project template, are you supposed to also copy the phaser.js or phaser.min.js from the build folder into your game file? 2. Do you have to make the css and assets folders on your own? 3. when you separate your css, html, and js folder, how do you call them in your html file? 4. What are the bare necessities you need to make a game that you will wrap using CocoonJS for iPhone and Android? Smart Watches? full length: So I just finished the "Getting Started" tutorial on Phaser's website; although I found it useful, I felt that it did not properly address how to start a new entirely from scratch( i.e. GitHub repo). My understanding right now is that you should copy the "Basic" or "Full Screen Mobile" project templates from the resource folder into your text editor and then I'm confused at this point. Are you supposed to also copy the phaser.js or phaser.min.js from the build folder into your game file? What about the css and assets folders? Are you also supposed to make those on your own as well? I just thought it was confusing how the "Getting Started" tutorial had everything in it's own one file (css, html, and js) and I know I want to separate my different file types into their own folders (btw, when you separate your css, html, and js folder, how do you call them in your html file?). I am coming from an Android Studio (using LibGDX) background where new projects automatically have all the folders you need to make an app (assets, MyGDXGame, Manifest, Java, and some other files you'd only touch once), so having to copy/paste/create a new folder (to make your game playable) into your game file is very foreign to me. I'm just trying to get started with a simple ball-maze game for mobile platforms (iPhone, Android, and maybe smart watches). Thanks!
  6. Hey, I've added a 'complete' state to my game. Here is a playable example: juliahofs.nl/platformer3/platformer_test.html You have to pick up all 10 coins to be able to see the problem. When you see the text, just click on the screen and continue. I've put this piece of code in it: Platformer.Complete = function (game) {};Platformer.Complete.prototype = {create: function () {var wonImage = game.add.sprite(game.world.centerX, 200, 'IWon');wonImage.anchor.setTo(0.5, 0.5);var restartText = game.add.text(game.world.centerX, 500, "START", {font: "35px Roboto", fill: "#000", align: "center"});restartText.anchor.setTo(0.5, 0.5);restartText.inputEnabled = true;restartText.events.onInputDown.add(function() {game.state.start('Play');}, this);}};When I click the start text, the game only flickers. It doesn't restart the game. I'm guessing it has something to do with the onInputDown event? Or should I destroy the image and the text of the complete state (I thought this was done automatically when changing states). Any tips?
  7. Hi everyone, I just write a short manual in Italian in which I explain how to make a game in HTML5 and Phaser If you want, see it on Amazon !
  8. How would I have my game start when it is clicked?
  9. Hello Guys, I do not know if this is the right place, I would ask for help. They are Italian is brand new, a lot of work with graphics (this is my website: www.samuelesciacca.it) but now I'm starting to work with javascript. I would like some help from you, I need a good manual where to start, you have some good advice, I'm not very good at English, I'm using the translator, the study yet, but I'm not very good at it, I'm getting better. [Excuse me if I'm wrong section D:]