Jump to content

Search the Community

Showing results for tags 'createfromobjects'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 7 results

  1. I am using createFromObjects (Link to API) to create a collection of Sprites from the object layer imported from a Tiled JSON file. I have successfully created the collection of sprites, however, I seem to be missing some critical data from these newly created Sprite objects. The original JSON tile data has a 'properties' field containing a unique key_id for each particular 'key' tile which appears to not copy over with this method invocation. Is there a way to get these 'properties' values from the object layer into each of the new Sprite objects?
  2. I'm making a game in Phaser using Tiled for level design. However, when I rotate objects in the object layer and use the createfromobjects function to generate those objects in the game itself, the x and y positions have been messed up. I've taken screenshots to demonstrate: In Tiled In Phaser How do I solve this? Is this a known bug with the current version of Phaser?
  3. I'm trying to create a "zone" around body's of water where a player can fish. To do so, I'm using tiled and drawing a rectangle object around the bodies of water. This "zone" ideally is invisible, but could also just be tiles. I'm trying to use the createFromObjects() method on my map. I'm following the phaser example, and looking at the docs. One of the required parameters is the gid. However my json export simply does not contain a gid property. It has an id for the objects, which I've tried to use, and I've even created the gid manually by typing it into the json. However both of these just create objects with 0 width and height. What am I doing wrong? How do get objects from Tiled into phaser? I'm also open to trying createFromTiles to accomplish this goal or any other advice. Game.js beach.json Boot.js main.js Preload.js index.html
  4. Hi all, I am really lost at how to use createFromObjects() in phaser.The object that I have used in the map is a part of a tileset but my code displays the entire tileset(which I do not want).The object layer is named as "Object Layer 1" and the tileset is "drink".My json file is attached.My code(as of now )is: var game=new Phaser.Game(800,600,Phaser.AUTO,'',{ preload:preload,create:create,update:update }); function preload(){ game.load.tilemap('map','maze2.json',null,Phaser.Tilemap.TILED_JSON); game.load.image('rocks','oppcastle-mod-tiles.png'); game.load.image('drinks','Food and drink package.png'); game.load.image('dude','index.png'); } var map; var layer; function create(){ game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#787878'; map = game.add.tilemap('map'); map.addTilesetImage('oppcastle-mod-tiles','rocks'); layer = map.createLayer('Tile Layer 1'); //map.setCollisionBetween(1,30,true,'layer'); layer.resizeWorld(); layer.wrap = true; //creating items items=game.add.group(); items.enableBody=true; map.createFromObjects('Object Layer 1',183,'drinks',0,true,false,items); player=game.add.sprite(0,game.world.height/2,'dude'); } function update(){ } Also,I will really grateful if you could tell me how should I go about setting collision between "dude" and "drink"(I do not understand the parameters).Please please please help.I am going nuts over it for quite a long now.Thanks in advance. Regards, Brooks maze2.json
  5. Hi there. I'm an experienced JS dev looking to get into Game Development. I've started out with a fairly small top-down "rpg" style game. I'm used the program "Tiled" to create the world map. So far i've been following this tutorial to get started, learn the basics of Phaser, but now i'm unfortunately running into this problem. This tutorial is about 2 years old, and uses it's own "object" generator, however i'd really like to use Phaser's native `.createFromObjects` function. My code is as follows; this.map = this.game.add.tilemap("world"); this.map.addTilesetImage("sheet", "spritesheet"); let map = this.map; let objects = this.game.add.group(); objects.enableBody = true; this.map.objects.objects.forEach(function(element) { map.createFromObjects(element.name, element.gid, element.properties.sprite, 0, true, false, objects); }); The error I receive in the console; Tilemap.createFromObjects: Invalid objectgroup name given: goldCoins Tilemap.createFromObjects: Invalid objectgroup name given: playerSpawn Tilemap.createFromObjects: Invalid objectgroup name given: goldCoins Tilemap.createFromObjects: Invalid objectgroup name given: campFire Tilemap.createFromObjects: Invalid objectgroup name given: stool Tilemap.createFromObjects: Invalid objectgroup name given: sign I've cut out the majority of the code for sake of saving space in this forum post, but the full code is available here. I've already looked up multiple forum posts, each with their own solutions to fix the bug i'm experiencing, however none have worked. I've tried replacing the "groups" param with the Tiled object's name, as per this post, but i'm unable to find a fix for this. I'd appreciate any help anyone may provide for me.
  6. helo! pls someone can send me an example for createFromObjects method i couldnt recognize what is the gid thx for any advance
  7. Hello! I have this error on console: Tilemap.createFromObjects: Invalid ObjectGroup name given: objects I had not used before "createFromObjects" so I do not really understand the reason for what I'm doing wrong. This is my code inspirated in @valueerror code: // map this.map = this.game.add.tilemap('level2_2'); this.map.addTilesetImage('sprite'); this.map.setCollisionBetween(0, 238); this.layer = this.map.createLayer('Level'); // this.layer.debug = true; this.layer.resizeWorld(); this.layer_tiles = this.game.physics.p2.convertTilemap(this.map, this.layer); this.customPlatform = this.game.add.group(); this.map.createFromObjects('objects', 10, 'sprite', 10, true, false, this.customPlatform); this.customPlatform.forEach(setupMovingPlatforms, this); this.layerobjects_tiles = this.game.physics.p2.convertCollisionObjects(this.map, 'objects'); Any help? A greeting.
  • Create New...