Search the Community

Showing results for tags 'error'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 112 results

  1. I've been working on a prototype for the last few weeks using Phaser v2.2.2 with moderate success. Earlier this week I decided it was probably time to update Phaser to keep current. Everything went relatively smoothly except for this one issue I've been dealing with since. Before posting here, I did as much research as I could to see if any breaking changes had come with this new version regarding groups and sprites. I didn't see anything in the release notes, nor did I see any changes in the code when I looked. So I'm hoping someone with more insight could help me out here. In a loop, I'm adding invisible sprites to a group, with coordinates surrounding another sprite: var sprite = this._tile_collisions.create(position.x, position.y);sprite.valid = true;sprite.height = 50;sprite.width = 50;sprite.inputEnabled = true;sprite.events.onInputDown.add(this._canMoveToTile, this);this._game.physics.arcade.enable(sprite);this._tile_collisions.add(sprite);And then in an update method I'm checking for overlap with another group: this._game.physics.arcade.overlap( collisions, this._tile_collisions, function (collider, tile) { // I cannot get the index of this child var index = this._tile_collisions.getChildIndex(tile); }, null, this);I should probably mention that the onInputDown event on the sprite removes the children from the group (using removeChildren()), tweens the player sprite to a new position, and then adds new sprites to the group. When create() is called for the first time, things run fine. However, after that sprite movement everything falls apart. Error: The supplied DisplayObject must be a child of the callerThis used to work beautifully until I upgraded. So my question is: has something changed that I'm not aware of that should alter the way I'm writing this? If so, how can I get this overlap to work?Any help is greatly appreciated, and if I need to give more details just let me know.
  2. Hi guys, I'm getting errors with the new version => http://screencast.com/t/3j65cFLOD this.game.scale.startFullScreen(false, false);Thanks in advance
  3. Hello, I've got a strange error. I've got a quitting menu in my game which basically ask you if you want to quit or not when you click on a button (that part works fine). If ever you answer "Nope" then I will destroy without any mercy all sprites that were used to buld the quit menu (that part kinda works but wait for it...). Problem is if you can't set your mind and you click that quitting button once again, and decide to say no a second time (why would you even do that I don't know but...) and at that point no sprites are destroyed (none, not even one) but the game unpause for the rest of it and there's menu bits in the game (great T_T). Also it throws an error at the 8th element (it doesn't destroy any of the first seven ones though) which is : "Uncaught TypeError: Cannot read property 'parentNode' of null". I've tried real hard to understand this but I don't. Why the hell does it works once and not twice? Here's some code : Quit Menu code : quitButton = game.add.sprite(SIZE_X * 0.03, SIZE_Y * 0.03, 'quit'); quitButton.inputEnabled = true; quitButton.events.onInputUp.add(function () { var darkScreen; var exitButton, exitButtonText, exitButtonHitBox; var unpauseButton, unpauseButtonText, unpauseButtonHitBox; var showQuitMessage; var quitTitleSprite, quitMessageSprite; // Pause game pauseGame(game, gameBoard); miniature.inputEnabled = false; quitButton.inputEnabled = false; onMenu2 = true; // prevents the miniature and the quit button from poping on top of the darkened screen // darken screen (black transparent sprite of the size of the screen) darkScreen = game.add.graphics(0, 0); darkScreen.beginFill(0x000000, 1); darkScreen.alpha = 0.5; darkScreen.drawRect(0, 0, SIZE_X, SIZE_Y); // White box showQuitMessage = game.add.graphics(0, 0); showQuitMessage.beginFill(0xFFFFFF, 1); showQuitMessage.drawRect(SIZE_X * 0.2, SIZE_Y * 0.15, SIZE_X * 0.6, SIZE_Y * 0.7); // Text output quitTitleSprite = game.add.text(SIZE_X * 0.4, SIZE_Y * 0.3, quitTitle, {font: 'bold ' + Math.floor(SIZE_Y / 15) + 'pt Arial', fill : '#000'}); quitMessageSprite = game.add.text(SIZE_X * 0.325, SIZE_Y * 0.45, quitMessage, {font: Math.floor(SIZE_Y / 30) + 'pt Arial', fill : '#000'}); // exitButton && unpauseButton graphics exitButton = game.add.graphics(0, 0); exitButton.beginFill(0x81DEED, 1); exitButton.drawRect(SIZE_X * 0.35, SIZE_Y * 0.65, SIZE_X * 0.1, SIZE_Y * 0.06); exitButtonText = game.add.text(SIZE_X * 0.38, SIZE_Y * 0.665, quitButton1Text, {font: Math.floor(SIZE_Y / 40) + 'pt Arial', fill : '#000'}); unpauseButton = game.add.graphics(0, 0); unpauseButton.beginFill(0x81DEED, 1); unpauseButton.drawRect(SIZE_X * 0.55, SIZE_Y * 0.65, SIZE_X * 0.1, SIZE_Y * 0.06); unpauseButtonText = game.add.text(SIZE_X * 0.58, SIZE_Y * 0.665, quitButton2Text, {font: Math.floor(SIZE_Y / 40) + 'pt Arial', fill : '#000'}); // exitButton && unpauseButton clicking gestion unpauseButtonHitBox = new Phaser.Rectangle(SIZE_X * 0.55, SIZE_Y * 0.65, SIZE_X * 0.1, SIZE_Y * 0.06); exitButtonHitBox = new Phaser.Rectangle(SIZE_X * 0.35, SIZE_Y * 0.65, SIZE_X * 0.1, SIZE_Y * 0.06); game.input.onDown.add(function(pointer) { if (onMenu2) { if (unpauseButtonHitBox.contains(pointer.x, pointer.y)) { unpauseGame(game, gameBoard, 2, showQuitMessage, unpauseButton, exitButton, darkScreen, quitTitleSprite, quitMessageSprite, unpauseButtonText, exitButtonText); miniature.inputEnabled = true; quitButton.inputEnabled = true; } else if (exitButtonHitBox.contains(pointer.x, pointer.y)) location.reload(true); } }); });Pausing function : function pauseGame(game, gameBoard) { for (var i = 0; i < NB_CELL_Y; i++) { for (var j = 0; j < NB_CELL_X; j++) { gameBoard.puzzle[i][j].sprite.inputEnabled = false; } } }Quitting the quitting menu code (or unpause function) : // After the menu argument, all args must be sprites and they will all be destroyed function unpauseGame(game, gameBoard, menu) { var i; if (menu == 1) // full picture Menu onMenu = false; // useful for stopping some sprite events, and starting others else if (menu == 2) // exit Menu onMenu2 = false; // Allows the sprites to be moved again if (onMenu == false) // the game can't go back to it's normal behavior if we're still on the full picture menu { for (i = 0; i < NB_CELL_Y; i++) { for (var j = 0; j < NB_CELL_X; j++) { gameBoard.puzzle[i][j].sprite.inputEnabled = true; } } } // deletes the sprites that made the menu for (i = 3; i < arguments.length; i++) { console.log("arg["+i+"] destroyed."); arguments[i].destroy(); } }Here's the console log : inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startpuzzle_plus.js:316 arg[3] destroyed.puzzle_plus.js:316 arg[4] destroyed.puzzle_plus.js:316 arg[5] destroyed.puzzle_plus.js:316 arg[6] destroyed.puzzle_plus.js:316 arg[7] destroyed.puzzle_plus.js:316 arg[8] destroyed.puzzle_plus.js:316 arg[9] destroyed.puzzle_plus.js:316 arg[10] destroyed.phaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled false d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: true, priorityID: 0, useHandCursor: false…}phaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}_dragPoint: d.Point_pointerData: Array[10]_tempPoint: d.PointallowHorizontalDrag: trueallowVerticalDrag: trueboundsRect: nullboundsSprite: nullbringToTop: falseconsumePointerEvent: falsedragFromCenter: falsedragOffset: d.Pointdraggable: trueenabled: truegame: d.GameisDragged: falsenext: d.InputHandlerpixelPerfect: falsepixelPerfectAlpha: 255prev: d.InputHandlerpriorityID: 0snapOffset: d.PointsnapOnDrag: falsesnapOnRelease: falsesnapX: 0snapY: 0sprite: d.SpriteuseHandCursor: false__proto__: Objectphaser.min.js:6 InputHandler startphaser.min.js:7 inputEnabled true d.InputHandler {sprite: d.Sprite, game: d.Game, enabled: false, priorityID: 0, useHandCursor: false…}phaser.min.js:6 InputHandler startpuzzle_plus.js:316 arg[3] destroyed.puzzle_plus.js:316 arg[4] destroyed.puzzle_plus.js:316 arg[5] destroyed.puzzle_plus.js:316 arg[6] destroyed.puzzle_plus.js:316 arg[7] destroyed.phaser.min.js:7 Uncaught TypeError: Cannot read property 'parentNode' of nullActually I'm talking of sprite but there's some text and graphics too, but since it works the first time I guess ."destroy()" works on them too. If you neef any more info I'll be glad to give it, sorry if I'm not very precise and for the high number of lines of code. Thanks in advance! Stupid PS : Is it me or does Syntax Highlighting in the code balise has a serious problem (or more precisly is inexistant).
  4. Hi, I am creating a game I have such a code in the method "create()": game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL;game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;game.scale.refresh();And I have an eventListener in chat window: if(message != '/fullscreen') { var event = { type: "chatMessage", message: $( this ).val(), channel: activeChat, id: 1, cookie: getCookie(cookiename) }; var str = JSON.stringify(event); console.log(str); ws.send(str); } else { if (game.scale.isFullScreen) { game.scale.stopFullScreen(); } else { game.scale.startFullScreen(false); game.scale.refresh(); } }Everything works fine on localhost:8888 port, but when I change the port on localhost:8000/game there is such an error: @ Phaser.ScaleManager: requestFullscreen failed or device does not support the Fullscreen API @
  5. So I am trying to import CSV tilemap to my game, using csv collision sample as help. Now it gives this error. Uncaught TypeError: Cannot read property 'width' of undefined which is pointing to this line. Variable map is defined in beginning map = this.game.add.|tilemap('kentta', 20, 20);Preloading is made in external preload.js file, in preload function like this: this.game.load.tilemap('kentta', 'assets/kentta.csv', null, Phaser.Tilemap.CSV);this.game.load.image('tileset', '/assets/tileset.png');
  6. Hi, and nice to meet you all. I am writing because i was triying to build the mightyeditor from source to test in on windows 8,1 64 bits, The installation goes cool and good so on, but when i open the browser and mark "Create New Account" and complete all the fields, always return "Sign in Failed". It can be a possible issue? Or the login and register module is not include at the source? In any case please would be awesome if you clarify me this. Thanks in advance Chevalsky
  7. Hello! I am just starter and my question may be silly (: I installed WAMPserver and cloned phaser-examples to "home" folder (so I can access it on localhost/phaser-examples). As I understood, I need to run localhost/phaser-examples/examples or localhost/phaser-examples/examples/index.html but neither of it works, and I get "500 Internal Server Error". On the other hand, "hellophaser" works perfectly, and also I am able to load part f page by opening examples/index.html directly. Here are some screenshots to illustrate the problem: 1) http://ipic.su/img/img7/fs/500-internal-error.1424334943.png 2) http://ipic.su/img/img7/fs/failed-to-load.1424334962.png I am running Windows 7 64bit, Firefox 35.0.1, WAMP server. Skype is shut down. Thank you in advance!
  8. I've published an APK as alpha test on Google Play. The testers have no trouble with the opt-in screen or following the link to the store page, but when they click on "Install" they always get some kind of error, such as Error code 941 or RPC:S-2;AEC-2 or problems with the signature. I signed it using -sigalg SHA1withRSA -digestalg SHA1 and that version is online now, but the errors persist. Anyone knows what might be wrong? BTW, the game was created using phaser and cocoonjs.
  9. Hi, I have made a game that works fine and am trying to put some states in. I have set all the code up and I keep getting the 'Uncaught ReferenceError: MYFUNCTION is not defined'. Here is a bit of the code so you get the idea. It's the main game state. If I take out the function being called it calls the same error on the next function. I don't understand why the functions aren't being defined? var theGame = function(game){}theGame.prototype = { create: function(){ }, update: function(){ MYFUNCTION(); }, MYFUNCTION: function(player, coin) { some stuff; }}Any help would be great! Thanks
  10. Hi, I have a huge problem with oimo and ground created with CreateGroundFromHeightMap. Please look at this: http://www.babylonjs-playground.com/#W3NZA Maybe I am doing something terribly wrong? Marius
  11. Hi, this is my first post on here. Anyways I need help trying to solve this problem. I am making a 2D rpg game, and for now I am using a 2D array map on Phaser JS as a place holder for an actual map in the future. I need the map to generate randomly every time. I have tried my code on Phaser version 1.12 and it works. However, when I tried it on the latest version (v2.2.0) of Phaser, it did not work. I keep getting an error saying "Uncaught TypeError: Cannot set property 'content' of undefined". Here is my source code: // font sizevar FONT = 22;//Map's Displayvar mapText;//var Height and Width for the Map's COLS and ROWSvar HEIGHT = 550;var WIDTH = 800;//Key variable set upvar cursors;var spaceKey;//offset for map's positionvar MAP_OFFSET = 2.38;//Game's height and widthvar gameHeight = 600, gameWidth = 800;//Style of textvar style = { font: FONT + "px monospace", fill:"#fff"};// map dimensionsvar ROWS = HEIGHT/FONT;var COLS = WIDTH/FONT/0.61;// number of actors per level, including playervar ACTORS = 10;// the structure of the mapvar map;// the ascii display, as a 2d array of charactersvar asciidisplay;// initialize phaser, call create() once donevar game = new Phaser.Game(gameWidth, gameHeight, Phaser.CANVAS, '', { preload: preload, create: create, update: update});function preload() { game.load.spritesheet('dude', 'assets/dude.png', 32, 48);}function create() { game.physics.startSystem(Phaser.Physics.ARCADE); player = game.add.sprite(32, game.world.height - 150, 'dude'); game.physics.arcade.enable(player); player.body.gravity.y = 1500; player.body.collideWorldBounds = true; player.animations.add('left', [0, 1, 2, 3], 10, true); player.animations.add('right', [5, 6, 7, 8], 10, true); //Subject to change: cursors = game.input.keyboard.createCursorKeys(); spaceKey = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); // initialize map initMap(maze(ROWS, COLS)); // initialize ascii display asciidisplay = []; for (var y=0; y<ROWS; y++) { var newRow = []; asciidisplay.push(newRow); for (var x=0;x<COLS;x++) newRow.push(initCell('', x, y + MAP_OFFSET)); } drawMap();}function update() { player.body.velocity.x = 0; if (cursors.left.isDown) { player.body.velocity.x = -150; player.animations.play('left'); } else if (cursors.right.isDown) { player.body.velocity.x = 150; player.animations.play('right'); } else { //Stand Still player.animations.stop(); player.frame = 4; } if (spaceKey.isDown) { player.body.velocity.y = -550; }}function initCell(chr, x, y) { // add a single cell in a given position to the ascii display game.add.text(FONT*0.6*x, FONT*y, chr, style);}//creating the mapfunction initMap(m) { // create a new random map map = []; for (var j= 0; j<m.x*2+1; j++) { var line= []; if (0 == j%2) for (var k=0; k<m.y*4+1; k++) if (0 == k%4) line[k]= '+'; else if (j>0 && m.verti[j/2-1][Math.floor(k/4)]) line[k]= ' '; else line[k]= '-'; else for (var k=0; k<m.y*4+1; k++) if (0 == k%4) if (k>0 && m.horiz[(j-1)/2][k/4-1]) line[k]= ' '; else line[k]= '|'; else line[k]= ' '; if (0 == j) line[1]= line[2]= line[3]= ' '; if (m.x*2-1 == j) line[4*m.y]= ' '; map.push(line.join('')+'\r\n'); } return map.join('');}function drawMap() { for (var y = 0; y < ROWS; y++) for (var x = 0; x < COLS; x++) asciidisplay[y][x].content = map[y][x];}function maze(x,y) { var n=x*y-1; if (n<0) {alert("illegal maze dimensions");return;} var horiz =[]; for (var j= 0; j<x+1; j++) horiz[j]= [], verti =[]; for (var j= 0; j<y+1; j++) verti[j]= [], here = [Math.floor(Math.random()*x), Math.floor(Math.random()*y)], path = [here], unvisited = []; for (var j = 0; j<x+2; j++) { unvisited[j] = []; for (var k= 0; k<y+1; k++) unvisited[j].push(j>0 && j<x+1 && k>0 && (j != here[0]+1 || k != here[1]+1)); } while (0<n) { var potential = [[here[0]+1, here[1]], [here[0],here[1]+1], [here[0]-1, here[1]], [here[0],here[1]-1]]; var neighbors = []; for (var j = 0; j < 4; j++) if (unvisited[potential[j][0]+1][potential[j][1]+1]) neighbors.push(potential[j]); if (neighbors.length) { n = n-1; next= neighbors[Math.floor(Math.random()*neighbors.length)]; unvisited[next[0]+1][next[1]+1]= false; if (next[0] == here[0]) horiz[next[0]][(next[1]+here[1]-1)/2]= true; else verti[(next[0]+here[0]-1)/2][next[1]]= true; path.push(here = next); } else here = path.pop(); } return {x: x, y: y, horiz: horiz, verti: verti};}That is just the Javascript file. Please tell me if you want my HTML code. Thanks! Links I used for tutorials to code this so far: http://gamedevelopment.tutsplus.com/tutorials/how-to-make-your-first-roguelike--gamedev-13677 (got the map) I also used an algorithm to generate the map details online. Please help and thanks in advance!
  12. hi buddies, got this code : additem:function() { box_ = this.box.getRandom(); if(!box_){ gameText.setText("now: NULLLLLLLLLLLLL"+box_.name); return; } gameText.setText("now: "+box_.name); box_.anchor.setTo(0.5,0.5); box_.reset(20,740); box_.body.velocity.x = -50; } but when running got the error ;Uncaught TypeError: Cannot read property 'velocity' of null ........................................... line 150 (box_.body.velocity.x = -50;) this.box is a group with several sprites, fullfilled with a for loop. gameText is a text variable in which i got the name of each item, but it nevers shows "NULLLLLLLLLLLL" so what im forgetting? why the box_ variable doesnt has the body.velocity.x ??? thanks in advance
  13. Hi, I'm new in babylon.js (and the others 3d frameworks). A moment ago I exported scene from *.obj to *.babylon. Now I'm trying to load it, but im getting error: My simple code: if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "/~patrol/objects/maps/city/scene.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); }
  14. Hi guys. Im following this tutorial and at some point i need to to this var device = new Phaser.Device();but running the game on console i got -> Uncaught TypeError: object is not a function on that line Any ideas? Thanks for your help
  15. Hi, I am attempting to export a blender file using the babylon.js exporter. My mesh contains an armature with incomplete and basic rigging, during my attempts to export the following situations occur: 1. processing complete of skeleton: Armature processing begun of mesh: characterWARNING: Maximum # of influencers exceeded for a vertex, extras ignored^repeated many many times 2. num positions : 65535num normals : 65535num uvs : 131070num uvs2 : 0num colors : 0num indices : 65535num skeletonWeights: 262140num skeletonIndices: 262140WARNING: The following mesh has exceeded the maximum # of vertex elements & will be broken into multiple Babylon meshes: character========= An error was encountered ========= File "C:\Program Files\Blender Foundation\Blender\2.72\scripts\addons\io_export_babylon.py", line 247, in execute mesh = Mesh(object, scene, self.multiMaterials, nextStartFace, forcedParent, nameID) File "C:\Program Files\Blender Foundation\Blender\2.72\scripts\addons\io_export_babylon.py", line 491, in __init__ self.name = object.name + nameIDERROR: Can't convert 'int' object to str implicitly========= end of processing ========= These two errors prevent me from exporting my man into babylon. Any advice as to how to proceed would be greatly appreciated, Thanks Joe
  16. As usual, I will begin with my tilemap: As you can see I added three objects that I want to use in my map as triggers. This is the object layer called Triggers in tiled. I did not change my loading code because I assumed that you don't have to load the object layer: constructor(game: Phaser.Game, key: string, manifest: any) { super(game, key); this.addTilesets(manifest.maze); this.wallLayer = this.createLayer(this.WallsLayer); this.backgroundLayer = this.createLayer(this.BackgroundLayer); this.shadowLayer = this.createLayer(this.ShadowsLayer); this.itemLayer = this.createLayer(this.ItemsLayer); this.objectLayer = this.createLayer(this.ObjectsLayer); this.creatureLayer = this.createLayer(this.CreaturesLayer); this.separateCreaturesFromTilemap(); this.separateItemsFromTilemap(); this.backgroundLayer.resizeWorld(); this.setCollisionBetween(1, 2, true, "Walls"); }And this fails at runtime with the exception: Uncaught TypeError: Cannot read property 'length' of undefined phaser.js:64576 Phaser.TilemapParser.parseTiledJSON phaser.js:64576 Phaser.TilemapParser.parse phaser.js:64260 Phaser.Tilemap phaser.js:61637 Tilemap Tilemap.ts:23 InGame.initializeMap InGame.ts:36InGame.create InGame.ts:26 Phaser.StateManager.loadComplete phaser.js:17993 Phaser.StateManager.preUpdate phaser.js:17753 Phaser.Game.update phaser.js:24518 Phaser.RequestAnimationFrame.updateRAF phaser.js:42978 _onLoopFinally, here is the object layer as it is defined in the .json: { "draworder":"topdown", "height":8, "name":"Triggers", "objects":[ { "height":0, "name":"warp", "properties": { "map":"volcano" }, "rotation":0, "type":"", "visible":true, "width":0, "x":60, "y":12 }, { "height":0, "name":"warp", "properties": { "map":"desert" }, "rotation":0, "type":"", "visible":true, "width":0, "x":276, "y":60 }, { "height":0, "name":"spawn_player", "properties": { }, "rotation":0, "type":"", "visible":true, "width":0, "x":60, "y":36 }], "opacity":1, "type":"objectgroup", "visible":true, "width":12, "x":0, "y":0 }
  17. I'm working on a game and need help with an error (Uncaught TypeError: Cannot set property 'frame' of undefined) that appears when I run code inside a function. Here's the full game code, with the error at line 60: function getRandom(min, max) { return Math.floor((Math.random() * (max - (min - 1))) + min);}var game = new Phaser.Game(480, 360, Phaser.AUTO, '', { preload: preload, create: create, update: update });var colorPosition = [0, 1, 2, 3];function preload() { game.stage.disableVisibilityChange = true; game.stage.backgroundColor = '#393837'; game.load.image('collide', 'assets/collide.png'); game.load.spritesheet('bucket-front', 'assets/bucket-front.png', 112, 82, 4); game.load.spritesheet('square', 'assets/square.png', 20, 20, 4); game.load.image('arrow', 'assets/arrow.png'); game.load.spritesheet('bucket', 'assets/bucket.png', 112, 82, 4);}function create() { collide = game.add.sprite(0, 317, 'collide'); game.physics.enable(collide, Phaser.Physics.ARCADE); arrow = game.add.sprite(175, 230, 'arrow'); for (var x = 0; x < 4; x++) { this['bucket' + x] = game.add.sprite((x * 120) + 4, 278, 'bucket', x) } squares = game.add.group(); function addSquare() { square = squares.create((getRandom(0, 3) * 120 + 50), -20, 'square', getRandom(0, 3)); game.physics.enable(square, Phaser.Physics.ARCADE); square.body.velocity.y=100; } for (var x = 0; x < 4; x++) { this['bucketFront' + x] = game.add.sprite((x * 120) + 4, 278, 'bucket-front', x) } game.time.events.loop(Phaser.Timer.SECOND * 1, addSquare, this);}function update() { if ((game.input.x - 120) > 0 && (game.input.x + 120) <= 480) { arrow.x = ((Math.round((game.input.x - 120) / 120)) * 120) + 55; } function removeSquare(collide, square) { //square.kill(); } game.physics.arcade.overlap(collide, squares, removeSquare, null, this); //if (game.input.activePointer.isDown) { game.input.onDown.add(swap(), this) function swap() { //alert(colorPosition) //alert((arrow.x - 55) / 120 + 1) var swap = colorPosition[(arrow.x - 55) / 120] colorPosition[(arrow.x - 55) / 120] = colorPosition[(arrow.x - 55) / 120 + 1] colorPosition[(arrow.x - 55) / 120 + 1] = swap //alert(colorPosition) this['bucket' + (Math.floor(arrow.x - 55) / 120)].frame = colorPosition[(arrow.x - 55) / 120] //Here's the line the error occurs on this['bucket' + (((arrow.x - 55) / 120) + 1)].frame = colorPosition[((arrow.x - 55) / 120) + 1] this['bucketFront' + (Math.floor(arrow.x - 55) / 120)].frame = colorPosition[(arrow.x - 55) / 120] this['bucketFront' + (((arrow.x - 55) / 120) + 1)].frame = colorPosition[((arrow.x - 55) / 120) + 1] //this['bucketFront' + (arrow.x - 55) / 120].frame = parseInt(colorPosition[(arrow.x - 55) / 120]) //alert(this['bucket' + (((arrow.x - 55) / 120) + 1)].frame) //alert(colorPosition[((arrow.x - 55) / 120) + 1]) }}This is my first attempt to do anything with JavaScript, so please try to be patient.
  18. Hi, I just upgraded my game to Phaser 2.1.3. (from v2.0.7) but it force some weird errors... - Especially PIXI is undefined. (I fixed that I load pixi.js to header) - biggest problem is that Pathfinder Plugin stopped working... (https://github.com/appsbu-de/phaser_plugin_pathfinding), maybe it is working but is not loaded it's loaded like this: pathfinder = game.plugins.add(Phaser.Plugin.PathFinderPlugin); Please check my screenshot, I need some advice how to fix this to work on latest version of Phaser
  19. Hello, I am currently learning how to use phaserJS, I am familiar with game development process, and I create HTML5 games before. Upon trying tutorial from Phaser and HelloPhaser, I tried it out on my localhost (with Apache server ON). It works, but on google chrome, the console shows an error "404 File Not Found" while trying to access phaser.map file. Granted, there is no phaser.map file, and only a single minifed phaser file. What confuses me is, why should it ask for phaser.map? Is the error normal (expected), Please enlighten me? Thank you.
  20. Hi, I wanted to use phaser in meteor following this guide http://www.html5gamedevs.com/topic/4886-how-to-use-phaser-with-meteor/ but I have a problem. when I create a meteor project and then run "meteor add phaserio" I get this: mrt add phaserio✓ phaserio tag: https://github.com/t...aser.git#v0.0.1 Done installing smart packages Stand back while Meteorite does its thing Done installing smart packages Ok, everything's ready. Here comes Meteor! => Errors while scanning packages: While building package `phaserio`:error: File not found: phaser/build/phaser.js /usr/lib/node_modules/meteorite/lib/command.js:41 throw "Command exited with " + code + "/" + signal; ^Command exited with 1/null can anybody help me, please?
  21. I'm trying to spawn a randomly coloured block and to do so I am using math.random and the console says everything is loading but the assets aren't loading. There are no errors in it but can anyone find an error that might be causing the assets not to load? Parts of the code that's relevant is coloured green. Thanks for any help. My Code: var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update,});var x = Math.floor(Math.random () * 800); // ball spawns in a random placevar y = Math.floor(Math.random() * 600);var text; var colour = Math.random() * 3;function preload() {cursors = game.input.keyboard.createCursorKeys(); //allows keyboard inputthis.game.load.image("block","assets/block.png");this.game.load.image("redBlock","assets/red.png");this.game.load.image("greenBlock","assets/green.png");this.game.load.image("blueBlock","assets/blue.png");} function create() {this.game.physics.startSystem(Phaser.Physics.ARCADE);this.game.scale.pageAlignHorizontally = true; //centers canvasthis.game.scale.pageAlignVertically = true;this.game.scale.refresh(); block = this.game.add.sprite(x,y,"colour"); // x and y are randomy coordinates the ball spawns atthis.game.physics.arcade.enable(block);block.body.velocity.setTo(200,200);block.body.collideWorldBounds = true; block.body.bounce.set(1); player = this.game.add.sprite(10,10,"block");this.game.physics.arcade.enable(player);player.scale.setTo(0.2,0.2);player.body.collideWorldBounds = true;} function update() { player.body.velocity.x = 0;player.body.velocity.y = 0; if(colour < 1){colour = "redBlock";} if(colour < 2){colour = "blueBlock";} if(colour < 3){colour = "greenBlock";} if(cursors.left.isDown){player.body.velocity.x += -200; } if(cursors.right.isDown){player.body.velocity.x += 200;} if(cursors.down.isDown){player.body.velocity.y += 200;} if(cursors.up.isDown){player.body.velocity.y += -200;}}
  22. Im following this tutorial but im changing some of the sprites. So, when the game is running, sporadically this error appears %c %c %c Phaser v2.0.7 | Pixi.js v1.6.1 | WebGL | WebAudio %c %c http://phaser.io %c %c ♥%c♥%c♥ (03:01:25:504) at public_html/js/phaser.js:22011Uncaught TypeError: Cannot read property 'x' of undefined (03:02:20:821 | error, javascript) at Phaser.Sprite.setFrame (public_html/js/phaser.js:31278:33) at Phaser.Animation.play (public_html/js/phaser.js:44089:22) at Phaser.AnimationManager.play (public_html/js/phaser.js:43593:45) at Neon.item.spawnEnemy (public_html/js/Game.js:61:26) at Neon.Game.update (public_html/js/Game.js:43:23) at Phaser.StateManager.update (public_html/js/phaser.js:16546:35) at Phaser.Game.update (public_html/js/phaser.js:22122:24) at Phaser.RequestAnimationFrame.updateRAF (public_html/js/phaser.js:38277:19) at _onLoop (public_html/js/phaser.js:38263:30)> This is update update: function() { this._spawnRate += this.time.elapsed; if (this._spawnRate > 1000) { this._spawnRate = 0; Neon.item.spawnEnemy(this); } this._enemyGroup.forEach(function(enemy) { enemy.angle += enemy.rotateMe; }); if (!Neon._lives) { this.add.sprite((Neon.GAME_WIDTH - 594) / 2, (Neon.GAME_HEIGHT - 271) / 2, 'game-over'); this.game.paused = true; } }This is spawnEnemy spawnEnemy: function(game) { var dropPos = Math.floor(Math.random() * Neon.GAME_WIDTH); var dropOffset = [-27, -36, -38, -48]; var enemyType = Math.floor(Math.random() * 5); var enemy = game.add.sprite(dropPos, dropOffset[enemyType], 'enemy'); enemy.animations.add('anim', [enemyType], 10, true); enemy.animations.play('anim', 10, true); game.physics.enable(enemy, Phaser.Physics.ARCADE); enemy.checkWorldBounds = true; enemy.events.onOutOfBounds.add(this.removeEnemy, this); enemy.anchor.setTo(0.5, 0.5); enemy.rotateMe = (Math.random() * 4) - 2; game._enemyGroup.add(enemy); },And on my Preloader.js i declare my spritesheet like this this.load.spritesheet('enemy', 'img/enemy.png', 50, 50);My spritesheet is 200 x 50 and has 4 different sprites The only thing i tried is to comment the error line on spawnEnemy but if i do that in the game only shows the first sprite. Help is appreciated
  23. Hey all, Just a quick heads up to share an odd solution to a problem that had me tearing my head out for a couple of days, thought it may come in handy for anyone else in the same boat. While working on a game where I was using P2 physics to detect a collision event between 2 physics bodies, I found that whenever the target sprite was rotated further than a certain amount all of my collision events would silently fail. I spent AGES trying different collision methods and none of them worked, when trying to implement a hack-ish workaround that I found on the forums (can't remember where) I realised that my collisions were now working fine, even though the method I was using returned something to the effect of "this doesn't work". Long story short - I found that by resetting a physics body's AABB data after every change in rotation made the collision events work again: //attackingThing.body.onBeginContact.add(reportSomething, this);//function rotateThing() { // thing.rotation += 1; // reportSomething fails unless you do this thing.body.data.updateAABB();}If anyone can enlighten me as to what/why/how this works, that'd be awesome. Phase on, dudes! OFM
  24. Hi guys, Today I'm trying to get my game running in CocoonJS, the game does work perfectly in a normal desktop and mobile browsers, but I'm getting some errors in CocoonJS. The error says: Javascript Exception (Tag: 'load'): Error: Phaser.Loader. Invalid XML given at e.Loader.xmlLoadComplete(js/min/phaser.min.js:12:9823) at XMLHttpRequest.i.xmlURL._xhr.onload (js/min/phaser.min.js:12:7414) It's my first time using CocoonJS so I have no idea where the error is coming from, but it is coming from Phaser.js itself. Any ideas?