Search the Community

Showing results for tags 'json'.



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 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

Found 91 results

  1. PIXI load and access JSON

    HI, Apologies for the rather basic question, but, the almost all of the articles & threads I've found are about loading JSON files in relation to a tileset or atlas. I just need to load some data, it doesn't have to be JSON, it could be csv, but examples are a bit thin on the ground. Is this possible? I have found one example, but it has a separate loader just for the JSON, it doesn't appear to add it into the loader resources - does it have to be done this way? Thanks! <edit> So, immediately after this I got it working by accessing the resources in loader complete method. But, I still wonder if it's possible to access the JSON from the cache as you do with sprites?
  2. Hi, I've been trying to load a json file using the assetmanagers textfile task, but this only returns an arraybuffer. I would have expected that the task returns a simple string which I then can parse to a json object. When loading the file directly through an xmlhttprequest, I get the string which can be parsed without a problem. Here's an example: http://www.babylonjs-playground.com/#GIKDTN#3 You can see in the console log, that the textfile task returns an arraybuffer and then fails to parse it as a json object. What am I doing wrong here? Thanks EDIT: I guess this is a bug in Babylon.js 3.2.0, when I switch to stable version in the playground, it works as I expected.
  3. Combining/Merging two json files

    Hey, I am working on a game that fetches an unknown amount of json files from a webserver. When everything is parsed, I need to combine everything in one big json object. //for loop game.load.json('cards' + i, deckStorageLink + decksData[i][0]); //while testing im only having two, 'cards0' and 'cards1' //different function var deck1 = game.cache.getJSON('cards0'); var deck2 = game.cache.getJSON('cards1'); var fullDeck = //deck1 and deck2 combined. so if I have [ { "country": "0", "points": "1", "action": "5", "description": "Draw two cards" } ] and [ { "country": "1", "points": "1", "action": "3", "description": "Steal a card" } ] I want [ { "country": "0", "points": "1", "action": "5", "description": "Draw two cards" } ] [ { "country": "1", "points": "1", "action": "3", "description": "Steal a card" } ] Does anyone know how to do this? -Ivo
  4. Preloading audio from JSON

    Hi everybody! I'm trying to preloading my audio from the same JSON where I preload the images. This is my JSON file: { "preloading": [ { "type": "image", "key": "image1", "url": "Images/image1.png", "overwrite": false }, { "type": "audio", "key": "audio1", "urls": [ "Audio/audio1.wav" ], "autoDecode": true } ], "meta": { "generated": "1401380327373", "app": "Phaser Asset Packer", "url": "http://phaser.io", "version": "1.0", "copyright": "Photon Storm Ltd. 2014" } } This is where I read the file: function preload(): void { game.load.removeAll(); game.load.pack('preloading', 'myjson.json', null, this); game.load.audio('audioN', 'Audio/audioN.wav', true); } function startOnClick() { audio = game.sound.play('audioN'); } If I launch my game, images are preloaded succesfully as audioN.wav, the audio in JSON give me this error: phaser.js:72849 Phaser.Loader: No URL given for file type: audio key: audio1 for all the audio file on my JSON file. The JSON file, the images folder and the audio folder are located in the root of the project. The audioN is a test that I've added to see if the problem was a type error in JSON or not, it doesn't change anything if I kick away it from my code. Any idea why I receive this error? Maybe @Arian Fornaris or anyone else could let me understand where my code is wrong? And, partial OT, why I cannot change the meta tags (except for "copyright")? If I do so it doesn't load nothing anymore.
  5. I am making a platformer game with Phaser 2.9.2 where the map is loaded from a JSON file and am having difficulty trying to make interactive tiles which are replaced by a new tile with a collision from a single-direction. I have found a function which allows me to control the direction of collision direction of tiles, so I am hoping to find out how to activate a function and replace individual tiles when there is the sprite and tile are overlapping. I have been thinking of adding the tiles individually in JSON with unique properties and using the .createFromObjects method, but I want every tile to have the same properties and the potential to make multiple stages. So I am hoping there is way to activate a function when the players sprite overlaps with the tile, and in the function it replaces that individual tile with another tile from the tilemap.
  6. Using tileset with json

    I created a map/level in JSON with "tiled map editor" which uses a tileset. Fot the JSON file look in the attachment. Now in code loop through the JSON and try to create the level/map. Problem is that it renders the same tile and not the different ones. If I run per layer it's ok (l=1, l<2), If I add the layer loop it renders with only 1 tile...(see attached image, there should be different walls) I tried several things. It looks like pixi does create all sprites with same tile? Many thanks Raymond // load json var level = require('../map/level1.json'); var tileHeight = level.tileheight; var tileWidth = level.tilewidth; var layers = level.layers; var height = level.height; var width = level.width; var tileset = PIXI.utils.TextureCache["./images/terrain.png"]; for(var l = 1; l < 5; l++ ) { // Layer var data = layers[l].data; for(var i = 0; i < data.length; i++) { // Postition on screen var y = i / height | 0; var x = i % width | 0; // Which tile we should use if( data[i] != 0) { var tileRow = (data[i] / 32) | 0; var tileCol = (data[i] - (tileRow * 32))-1 | 0; console.log('texture -> row: ' + tileRow + ' col: ' + tileCol + ' width: '+tileWidth+ 'tileHeight: ' + tileHeight); var rectangle = new PIXI.Rectangle(tileCol*32, tileRow*32, tileWidth, tileHeight); // x, y, w, h tileset.frame = rectangle; var layer = new PIXI.Sprite(tileset); layer.x = x * tileHeight; layer.y = y * tileWidth; this._game.stage.addChild(layer); } } } level1.json
  7. Hi folks. How do I get my character to walk and attack at the same time with 2 separate character atlas files? For instance, when you're walking, you press a key & while holding the walking keys, you can swing your sword WHILE walking at the same time through 2 separate but similar animation atlases. Thanks! ~M
  8. I have spent some time finding out how to animate tiles in a tile map loaded from a Tiled map exported to JSON. At first I built a utility class called TileMapAnimator (TMA) to animate some tiles using manual data and eventually I extended the class so that it could load animated tile data directly from the map files. With TMA you define your animations in Tiled and load them directly into your Phaser game! I'm sharing this code in the hope that others may find it useful. If you have invested into loading Tiled maps using the built in functions, I believe you can include animations in your game with very little retrofitting. TMA can animate hundreds of tiles without any notable performance degradation. Some usage restrictions apply: In TMA, each animation uses a fixed frame interval for all the tile frames. Tiled actually allows you to specify different durations per frame. Hence TMA picks the first duration as the frame interval. TMA requires tile animations to be defined on one of the tiles included in the animation. This is because TMA scans the map layer for these tiles and sets up the animated tiles at the designated locations Only one animated tile layer is supported for now. Perhaps I will extend TMA to support animation in multiple layers. How to use TMA Import the TMA class: import TilemapAnimator from "../graphics/TilemapAnimator"; In preload(), load the tile map and associated tile sets using the built-in Phaser map loading functions: this.load.tilemap('TileMap', 'assets/maps/world1/TileMap.json', null, Phaser.Tilemap.TILED_JSON); this.load.image('Ground', 'assets/graphics/world1/Ground.png'); Load the tile map again, but this time as a raw JSON file: this.load.json("TileMapAnimations", 'assets/maps/world1/TileMap.json'); In create(), set up the map and layers as usual: const tilemap = this.add.tilemap('TileMap'); const groundTileset = tilemap.addTilesetImage('Ground', 'Ground'); const groundLayer = tilemap.createLayer('Ground'); Create an instance of TMA, passing the game.time object, the tilemap and the layer containing the animations: const tilemapAnimator = new TilemapAnimator(this.time, tilemap, groundLayer); Load the animation into TMA, by specifying the cache key of the raw JSON object loaded in prefetch() using game.load.json(....) and start the tile animations: tilemapAnimator.addAnimationsFromTilemap("TileMapAnimations"); tilemapAnimator.start(); That's all there is to it! Note: I am no NPM expert, but if anyone is willing to turn this into an NPM package or some other practical library, please get in touch so we set it up! The TMA class file is attached below. TilemapAnimator.js
  9. Tilemap issue

    Hey guys I'm new to Phaser, I looked on Youtube and phaser examples for answers but didn't find any helpful one. I get this error on the console TypeError: location is undefined[Learn More] phaser.js:97736:25 getIndex http://127.0.0.1:5000/assets/phaser.js:97736:25 getTilesetIndex http://127.0.0.1:5000/assets/phaser.js:97770:16 addTilesetImage http://127.0.0.1:5000/assets/phaser.js:97313:19 create http://127.0.0.1:5000/main.js:36:5 loadComplete http://127.0.0.1:5000/assets/phaser.js:28709:13 finishedLoading http://127.0.0.1:5000/assets/phaser.js:75801:9 processLoadQueue http://127.0.0.1:5000/assets/phaser.js:75756:13 asyncComplete http://127.0.0.1:5000/assets/phaser.js:75828:9 fileComplete http://127.0.0.1:5000/assets/phaser.js:76711:13 loadImageTag/file.data.onload http://127.0.0.1:5000/assets/phaser.js:76098:17 Here is my code: var game = new Phaser.Game(500, 400, Phaser.AUTO, "", { preload: preload, create: create, update: update }); function preload() { game.load.spritesheet( "marioSmall", "assets/images/marioSmall.png", 34, 34, 6, 1 ); game.load.image("ground", "assets/images/ground.png"); game.load.tilemap( "map_01", "assets/tileset_json.json", null, Phaser.Tilemap.TILED_JSON ); game.load.image("tiles", "/assets/items.png"); } var mario; var ground; var map; var layer; function create() { // ground = game.add.sprite(0, 370, "ground"); // game.physics.arcade.enable(ground); // ground.body.immovable = true; // mario = new Mario(100, 100, 2000, 800, 200); map = game.add.tilemap("map_01"); map.addTilesetImage("items", "tiles"); layer = map.createLayer("Tile Layer 1"); } function update() { // game.physics.arcade.collide(ground, mario.sprite); // mario.checkInput(); }
  10. parsing JSON in firefox fails

    Hey guys, I'm new to this forum! Use to be an oldschool flash developer (erik.newgrounds.com) and am now seriously looking at building games in HTML5. I had zero problems until i opened my game in Firefox (54.0.1 (32-bits), and Pixi v4.5.0..) and it threw the following error: TypeError: resources['assets/images/bodyparts.json'].textures is undefined[Meer info] After digging a bit deeper and logging the above mentioned resource object i see: Object { _flags: 2, name: "assets/images/bodyparts.json", url: "assets/images/bodyparts.json", extension: "json", data: null, crossOrigin: "", loadType: 1, xhrType: "json", metadata: Object, error: Error, nog 17… } When i click the Error message i see the following error: Error trying to parse loaded json: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data I cant find anything wrong with my json, even JSONLint tells me its ok. Also in Chrome everything works perfectly fine. JSON object is attached to this topic. Any idea whats going on here? Thanks for the help! Erik Firefox v bodyparts.json
  11. Hi, I'm making platform games with phaser, and to do so i prepare my levels in inkscape, i give a label to each image so when i end it i finally get an .svg document with an x and a y for each labeled element. Then i replace and delete all the useless text with my code editor till i get it in a .json format so i can pass it to my game as a new level. Is a repetitive and boring work, i hate it. So now i'm thinking in write a little "program" or script to do it. What i really don't know is how to pass through a text that it isn't an html or a php. i would prefer to code it with js as is the language i know most, but i'm open to suggestions. I think it shouldn't be so difficult as is only gather some text and creating a new document, but i don't know where to start. Thanks!
  12. Preparing the Sprite-sheet

    I am trying to learn how to make a sprite from a spritesheet and I'm following Kitty's tutorial as a reference on how to work with spritesheets. https://github.com/kittykatattack/learningPixi#sprites I am using Texture Packer to create my spritesheet. I was successful in exporting all my images the only thing that has me confused is why do I have a .json file for each of my images? I suspect this is because I had to enable multipacking because all my images wouldnt fit on one sheet. In a lot of the examples I've seen online most devs just import one tile-sheet and one .json file. I was expecting Texture Packer to do the same, now I am unclear how I would import all of this...just for one sprite. Is there a better method of doing this? Quick info about the images I am using, I made a 3d render in Blender and exported the final render into .png frames, the size on each frame is roughly 2000x1000. Perhaps there's another way I could export my render and have it ready for PIXI?
  13. text fields from json-files

    Hello I working on a DonkeyKong-Game with multiple level-json-files and got a problem with text boxes/fields for the introduction-level. I wanted to create multiple text fields (content like x, y position and align is in json-files) between the platforms in the levels but I have problems with creating it. Is there something I can create text fields with? ForEach-functions and test=game.add.text don't work. Thank you text-data in json-file { "textData":[ { "height":90, "text":{ "fontfamily":"Arial", "halign":"center", "pixelsize":12, "text":"Bewege dich mit den Pfeil-Buttons der Touch-Steuerung unten links oder Pfeiltasten der Tastatur nach links und rechts.\nBer\u00fchre den Sprung-Button der Touch-Steuerung unten rechts oder den Aufw\u00e4rts-Pfeil der Tastatur um zu springen.", "valign":"center", "wrap":true }, "width":360, "x":0, "y":400 }, { "height":60, "text":{ "fontfamily":"Arial", "halign":"center", "pixelsize":8, "text":"Dein Ziel ist es, alle 3 Symbole eines Levels anzusammeln.\nUnd dabei nicht von den Hindernissen oder anderen Dingen gekillt zu werden.\nAnsonsten beginnt das Level von neuen.\nInsgesamt gibt es 6 Levels + die Winners Lounge am Ende.\n\nUnd Achtung, die Levels sind von der Art ziemlich ungew\u00f6hnlich. ", "valign":"center", "wrap":true }, "width":360, "x":0, "y":520 }, { "height":90, "text":{ "fontfamily":"Arial", "halign":"center", "pixelsize":12, "text":"Dies sind Feuer.\nUnd wenn du sie ber\u00fchrst, bist du tot.\nAlso spring dar\u00fcber.", "valign":"center", "wrap":true }, "width":360, "x":0, "y":280 }, { "height":90, "text":{ "fontfamily":"Arial", "halign":"center", "pixelsize":10, "text":"Achtung vor den F\u00e4ssern, sind wie die Feuer.\nBer\u00fchren = ToT\nDr\u00fcberspringen ist die \u00fcbliche Option, meistens.\nIn anderen Leveln sind sie durchaus gr\u00f6\u00dfer, schneller und\/oder zahlreicher.\nWerden von der Fassbariere aufgehalten.\n", "wrap":true }, "width":360, "x":0, "y":160 }, { "height":50, "text":{ "fontfamily":"Arial", "halign":"center", "pixelsize":8, "text":"Dies ist der B\u00f6se.\nIst total fussfaul und liebt neben F\u00e4sser werfen ganz besonders dich, pur und am St\u00fcck.\nAlso wenn du nicht als Zwischenmahlzeit enden willst, halt dich von ihm fern. ", "valign":"center", "wrap":true }, "width":180, "x":50, "y":80 }, { "height":50, "text":{ "fontfamily":"Arial", "halign":"center", "pixelsize":8, "text":"Das sind die 3 Zielsymbole.\nHier sind sie an einem Ort, in anderen Leveln irgendwo.\nSchnapp dir alle und du bist im n\u00e4chsten Level.", "valign":"center", "wrap":true }, "width":130, "x":90, "y":0 }, { "height":20, "text":{ "fontfamily":"Arial", "halign":"center", "pixelsize":8, "text":"Unsichtbare Fass-Barriere ->\n", "valign":"center", "wrap":true }, "width":120, "x":0, "y":230 } ], }
  14. I've been having a look through the phaser tutorials for json tiled maps and I've noticed that it's not clear on how to create a json tiled map that is 'phaser ready'. After creating a tiled map in tiled and following the code examples I've been unable to get passed the following error. Cannot read property '2' of undefined line phaser.js:98679 // find the relevant tileset sid = map.tiles[tile.index][2]; set = map.tilesets[sid]; version: 2.6.2 Is there anything obviously wrong with the code or the exported json tile map? Maybe there is a special way to export maps from tiled? Help would be appreciated. Thanks. game = new Phaser.Game(600, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload() { game.load.tilemap('map', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tmw_desert_spacing', 'assets/tmw_desert_spacing.png'); } function create() { map = game.add.tilemap('map'); map.addTilesetImage('tmw_desert_spacing'); layer = map.createLayer('Tile Layer 1'); } { "height":14, "layers":[ { "data":[0, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 0, 0, 40, 40, 0, 0, 40, 40, 40, 0, 40, 40, 0, 40, 0, 0, 40, 40, 0, 0, 0, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 40, 0, 40, 40, 40, 0, 40, 40, 40, 40, 40, 40, 40, 0, 40, 0, 40, 0, 40, 40, 40, 40, 40, 0, 40, 40, 40, 0, 40, 40, 0, 40, 0, 40, 40, 0, 40, 0, 40, 40, 40, 0, 0, 40, 40, 40, 0, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 40, 40, 40], "height":14, "name":"Tile Layer 1", "opacity":1, "type":"tilelayer", "visible":true, "width":14, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.0.1", "tileheight":32, "tilesets":[ { "firstgid":1, "source": { "columns":8, "image":"tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, "margin":0, "name":"tmw_desert_spacing", "spacing":0, "tilecount":48, "tileheight":32, "tilewidth":32, "type":"tileset" } }], "tilewidth":32, "type":"map", "version":1, "width":14 }
  15. Atlas not working with Spriter Player

    Hey, i'm currently working on my first animation with phaser + Spriter Player for Phaser + Spriter obviously. The animations work with the provided Spriter files in the example project of the player (Atlas.json, Atlas.png, TEST.json) but when i try to import my own test animation i encounter this error: (index):149 Cannot set frameName: forearm_l for all my frames in the sprite and for everone the first from the list in spriter is used instead (see image attached) Attache you can see my exported files which import fine but don't display as described. Thanks for any help in resolving this! Cheers test.zip
  16. local storage with JSON error

    hi, i would use the local storage to store value of my object. i set the object draggable and when the drag stop i would reveal parameter of this object. the problem is that i have this error : Uncaught TypeError: Converting circular structure to JSON i follow this part of tutorial : var car = {}; car.wheels = 4; car.doors = 2; car.sound = 'vroom'; car.name = 'Lightning McQueen'; console.log( car ); localStorage.setItem( 'car', JSON.stringify(car) ); console.log( JSON.parse( localStorage.getItem( 'car' ) ) ); But in my case that don't work. Why ? Thanks for your help. https://jsfiddle.net/espace3d/cmd0158g/ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:preload, create: create }); function preload() { game.load.image('circle', 'https://s13.postimg.org/xjhlzmiev/disc_png.png'); } function create() { this.projectile=game.add.sprite(200,200,'circle') this.projectile.number=1 this.projectile.name="weapon" this.projectile.inputEnabled=true this.projectile.input.enableDrag(true) this.projectile.events.onDragStop.add(reveal_param,this) } var reveal_param=function(sprite){ localStorage.setItem('_projectile', JSON.stringify(sprite)); var _projectile_var= JSON.parse( localStorage.getItem( '_projectile' ) ) ; alert(_projectile_var.name) }
  17. Curious About Tiled Syntax Error

    I get a syntax error Uncaught SyntaxError: Unexpected token : in the console when I load my tiled json maps. Everything runs fine, my maps are loaded correctly, but why does it give this error? json looks like: { "height":32, "layers":[ { "data":"AAAAAAAAAA" etc. I understand that there's no var declared at the beginning of the object, but it's saved as a json file and loaded as a json file. Why give this error? Just wondering. Thanks,
  18. Three.js subdivision surfaces

    Hi there ! I'm trying to add a subdivision surface on a loaded json file with Three.js and SubdivisionModifier.js or BufferSubdivisionModifier.js without any result. I searched and found various code and topic but none of them worked. That's why I'm looking for help here. my code with the BufferSubdivisionModifier.js : function initMesh() { var loader = new THREE.JSONLoader(); loader.load('js/cube.json', function(cubeGeometry, materials) { cubegeometryClone = cubeGeometry.clone(); cubegeometryClone.mergeVertices(); cubegeometryClone.computeFaceNormals(); cubegeometryClone.computeVertexNormals(); var modifier = new THREE.BufferSubdivisionModifier(1); smoothCube = modifier.modify( cubegeometryClone ); mesh = new THREE.Mesh(smoothCube, new THREE.MultiMaterial(materials)); // of course cube appears if you replace smoothCube by cubeGeometry mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.95; mesh.translation = cubegeometryClone.center(cubeGeometry); scene.add(mesh); }); } no errors in console my code with the SubdivisionModifier.js which is the example I found mostly : function initMesh() { var loader = new THREE.JSONLoader(); loader.load('js/cube.json', function(cubeGeometry, materials) { smooth = cubeGeometry.clone(); smooth.mergeVertices(); smooth.computeFaceNormals(); smooth.computeVertexNormals(); var modifier = new THREE.SubdivisionModifier(1); modifier.modify(smooth); // if I comment this line, cube show but, of course, with no surface smoothing mesh = new THREE.Mesh(smooth, new THREE.MultiMaterial(materials)); mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.95; mesh.translation = cubeGeometry.center(cubeGeometry); scene.add(mesh); }); } console show : TypeError: undefined is not an object (evaluating 'v.x') any help will be apreciated, I'm getting mad after 2 days of tries thanks
  19. Phaser.tilemap

    I'm having trouble trying to load a tilemap that was created in tiled in its native tile width and height. In tiled it was 32x32 but upon loading it, it gets scaled down to 16x16, I'm not sure if it's a problem somewhere else in the code or a missing parameter. It wouldn't be a problem but a lot of tilesheets are 32x32 and scaling them down in gimp reduces image quality, doing it in the code causes odd behavior. Things I've tried: Adding tileWidth and tileHeight parameters to the loading of the tilemap as well as the spritesheets Removing min/max scaling Scaling the layers to 2.0. https://github.com/asmith9/god-dang-zombies/blob/master/js/Game.js To be more clear: the problem is in the loading of 'spritesheet' and 'TILESET-04' which are natively 32x32 but appear 16x16
  20. Hi everyone, I have a strange issue with the webgl and tilesprite behavior which seems for me to not follow the Phaser documentation. My background is contained inside a sprite atlas described by a json file. All the sprites have dimension equal to a power of 2 (height and width) and the png file too. I have followed the tutorial https://phaser.io/examples/v2/tile-sprites/tiling-sprite-atlas It works great with this example and the octopus dimensions used are "w":62,"h":94 But, when I change one of this parameters to a power of 2, for example: "w":64,"h":94, the tilesprite has a strange behavior: the entire image is displayed from x:0 y:0 No problem with canvas. I suppose it is a newbee issue... any help? Thanks!
  21. Issue with JSONArray Animation

    Hi I have come to a dead in, I have attempted various research on platforms such as google, YouTube and Lynda however to no avail. I have used TexturePacker to create a spritesheet assiociated with JsonArray so that I can incorporate animations within my project however I am met with this Index error which is assiociated with the first line of code: this.sprite.animations.add('walk', Phaser.Animation.generateFrameNames('Slide', 1, 10), 10, true, false); this.sprite.animations.play('walk'); I have preloaded the required JsonArray and Image path within the preloader by doing the following: this.load.atlasJSONArray('robot', 'src/images/robots.png', 'src/images/robots.json'); And an example of this .json file is like this: { "filename": "Slide1.png", "frame": {"x":3574,"y":361,"w":409,"h":356}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":31,"y":170,"w":409,"h":356}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide2.png", "frame": {"x":3572,"y":2665,"w":406,"h":358}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":34,"y":168,"w":406,"h":358}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide3.png", "frame": {"x":3561,"y":1412,"w":403,"h":360}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":37,"y":166,"w":403,"h":360}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide4.png", "frame": {"x":3084,"y":1781,"w":400,"h":361}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":40,"y":165,"w":400,"h":361}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide5.png", "frame": {"x":3159,"y":1412,"w":400,"h":361}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":40,"y":165,"w":400,"h":361}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide6.png", "frame": {"x":2763,"y":2660,"w":400,"h":360}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":40,"y":166,"w":400,"h":360}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide7.png", "frame": {"x":2763,"y":3022,"w":400,"h":360}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":40,"y":166,"w":400,"h":360}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide8.png", "frame": {"x":3165,"y":2982,"w":402,"h":359}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":38,"y":167,"w":402,"h":359}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide9.png", "frame": {"x":3165,"y":2622,"w":405,"h":358}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":35,"y":168,"w":405,"h":358}, "sourceSize": {"w":567,"h":556} }, { "filename": "Slide10.png", "frame": {"x":3572,"y":2306,"w":407,"h":357}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":33,"y":169,"w":407,"h":357}, "sourceSize": {"w":567,"h":556} }], (Manually Rename Filename from Slide (1) to Slide1 in order to work however still met with an error) I have tried to find videos which will help me with creating an animation spritesheet with Json but every resource I follow I still get this error. If my mistake is not obvious feel free to point me to a good resource. Regards, Connor Solved: No where mentioned extension had to be removed. Eventually got it working.
  22. Hello I cannot load the map (made using Tiled Map Editor) using Phaser. Phonegap Desktop console shows this messages: In function "preload" i have this code: game.load.tilemap('map', 'assets/mapas2.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tiles', 'assets/tmw_desert_spacing.png'); In function "create" i have this code: map = game.add.tilemap('map'); // Now add in the tileset map.addTilesetImage('tiles', 32, 32); // Create our layer layer = map.createLayer(0); // Resize the world layer.resizeWorld(); mapas2.json: { "height":16, "layers":[ { "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 26, 26, 26, 26, 26, 26, 27, 30, 30, 33, 36, 42, 42, 42, 42, 37, 35, 30, 30, 33, 35, 25, 26, 26, 27, 33, 35, 30, 30, 33, 35, 33, 36, 37, 35, 33, 44, 27, 30, 33, 35, 33, 35, 33, 35, 41, 37, 35, 30, 33, 35, 33, 35, 33, 44, 26, 45, 35, 30, 33, 35, 33, 35, 41, 42, 42, 42, 43, 30, 33, 35, 33, 35, 25, 26, 26, 27, 30, 30, 33, 35, 33, 35, 33, 36, 37, 35, 30, 30, 33, 35, 33, 35, 33, 35, 33, 44, 26, 27, 33, 35, 33, 44, 45, 35, 41, 42, 37, 35, 33, 35, 41, 42, 42, 43, 30, 30, 33, 35, 33, 44, 26, 26, 26, 26, 26, 26, 45, 35, 41, 42, 42, 42, 42, 42, 42, 42, 42, 43, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], "height":16, "name":"Capa1", "opacity":1, "type":"tilelayer", "visible":true, "width":10, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tileheight":32, "tilesets":[ { "firstgid":1, "source":"\/tmw_desert_spacing.tsx" }], "tilewidth":32, "version":1, "width":10 } Here I leave you 2 files just if you want to try it. Tank you very much! tmw_desert_spacing.tsx
  23. Hi, `Loader#pack` works as follow: It first downloads the json file using XHR and then all the related assets. `Loader#onPackComplete` is triggered when json file was downloaded and all assets were enqueued in its internal queue. What if I would like to be notified *ONLY* when all related assets of current pack were downloaded?? How can I achieve this kind of behaviour assuming that I'm downloading multiple packs! Thank you!
  24. I have a sprite sheet image ("character1.png") and a JSON file ("character1.json') indicating the frame positions. The positions of frames are specified as follows: { "count" : 264, "filename" : "character1.png", "position" : [ { "x1" : 5, "x2" : 65, "y1" : 4, "y2" : 86 }, { "x1" : 69, "x2" : 131, "y1" : 2, "y2" : 87 }, ... ] } How do I load the sprite sheet with the command `game.load.spritesheet(...)`. Also, how do I play the animation and access a particular frame? Thanks. character1.json