Search the Community

Showing results for tags 'properties'.



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

  1. Hi, It seems that the latest Tiled program uses a different tiles "properties" syntax. Different from Phaser 3 expects. Currently if I export a JSON tilemap from Tiled (version 2018.06.01) I get the following tiles descriptions: "tilesets":[ { "columns":8, "firstgid":1, "image":"warTileset_64x64.png", "imageheight":512, "imagewidth":512, "margin":0, "name":"warTileset_64x64", "spacing":0, "tilecount":64, "tileheight":64, "tiles":[ { "id":2, "properties":[ { "name":"health", "type":"int", "value":1 }] }, { "id":5, "properties":[ { "name":"health", "type":"int", "value":2 }] }], "tilewidth":64 }], If I import this into Phaser 3 - I can't access any custom property. But if I modify JSON like this: "tilesets":[ { "columns":8, "firstgid":1, "image":"warTileset_64x64.png", "imageheight":512, "imagewidth":512, "margin":0, "name":"warTileset_64x64", "spacing":0, "tilecount":64, "tileheight":64, "tileproperties": { "2": { "health": 2 }, "5": { "health": 3 } }, "tilewidth":64 }], Then everything works as expected. I haven't used very old versions of both Phaser and Tiled, but it seems somebody has changed his syntax, which is not supported by both projects. Or I miss something? Question of course is how to access custom properties with the latest versions of Phaser 3 and Tiled? I create a tilemap in a standard way: ... scene.load.tilemapTiledJSON('map', '1.json'); ... this.map = scene.make.tilemap({ key: 'map' }); var groundTiles = scene.map.addTilesetImage('warTileset_64x64'); var groundLayer = scene.map.createDynamicLayer('ground', groundTiles, 0, 0); ... ... ... // Later when we process collision with specific tile var prop = tile.properties // No data here ...
  2. I want to draw a texture on the line that user draws on the screen. Like a mouse trail, so I follow this tutorial. . The only thing that doesn't answer me is sending the custom uv to the shaders. I vaguely remember that in C++, I can create struct or something and the shader will know how to handle it. It seems that is not the case here. I can't even figure out how does "index" property in vertex shader gets there. Even so, I can't use the "index" approach as the line won't be full rectangle as in the example. Right now, I copied & pasted the entire lines2d classes and try to customize to be able to draw texture on there, but I don't know how to send the custom uv that I've calculated to the shader. Anyone can explain that to me? Or am I looking at this a wrong way?
  3. I am developing a game using phaser. I wanted to add a feature where user will get alert before any obstacle comes. I am planning to assign a property, "jump": true, to a tile or an object. Is there any way to read this property of the tile that user is passing by. I am following this tutorial for game development - https://software.intel.com/en-us/html5/hub/blogs/how-to-make-a-sidescroller-game-with-html5/. Is there any other better way to achieve this? Your suggestions/ code snippets will be helpful. Thanks
  4. Hello, I ask this with some caution, obviously, since Mesh instances are fairly rich with "property" content as it stands. I'd like to add a couple of custom properties to help some client application code determine whether a mesh is "selectable" or not. I wonder how to go about doing this and keep a sane boundary between the rich existing properties and the application properties. First if it's even possible, in the face of operations like "clone", etc. As a strategy, for instance, I see naming conventions such as "CamelCase" or "camelCase", with or without leading "_underScores", and things of this nature, to provide some semblance of separation between so-called "public" and "private" concerns, as far as one can do so with JavaScript, at any rate. One thought is that I might run with a "__doubleUnderScore" to keep things further separate, but I wondered if there were commonly adopted strategies among the community for such as requirement. Thank you! Regards, Michael Powell
  5. Hello everyone, I have this doubt (little introduction before): I think is really helpful to use a sprite property to "store" another sprite. For example, when I have several enemies and I want all of them to have a health bar I can do something like this: var enemies = game.add.group(); for(var i = 0; i < 5; i++){ var enemy = game.add.sprite(0, 0, "enemy", 0); var health = game.add.sprite(enemy.x, enemy.y, "bar", 0); enemy.health = health; enemies.add(enemy); } By doing this, I can easily locate the health bar in the game later. For example if I want to change the bar's frame I only have to: enemies[i].health.frame = 1; I can do this several times, for example if I want to add a magic bar to the enemies, a text with the name, etc. The problem is, when I want to move the enemy sprite. At this moment, I create a tween for the 'main' sprite, and another tween for each of the properties: game.add.tween(enemies[i]).to({...}); game.add.tween(enemies[i].health).to({...}); game.add.tween(enemies[i].magic).to({...}); This is ok when you have just one property for each sprite, but when the numbers go up, it starts to look... problematic. Specially when each enemy have different properties. I was wondering if there's a way to move a sprite and 'all the sprites that belongs to them' at the same time with a single tween. Thank you! Gonzalo.
  6. I have a portion of my GUI created using the CastorGui extension. I've been trying to pass an object property from the colorSelector.getColor(); (r,g,b) values to another script (my main BJS script), as I have to keep the extension calls and functions in a seperate script. As a quick fix, I also tried to pass a global variable holding the parseFloat() (r.g.b) values, but I haven't had any luck passing these values using either method. What is the best method to pass these values - as well as to pass a CASTORGUI.GUISlider() value to a seperate script to use as a video slider control. I will also need to pass values back to my CasterGui script as well. Thanks for your help, DB
  7. Hello guys, I read http://www.html5gamedevs.com/topic/6495-add-more-custom-properties-to-sprite/ already and understand that in javascript it's free to add any custom property into any object. but i just get started Phaser with TypeScript because of I have experience in strong-type language like C#. I use its type-strict and don't want to use "any" type in order to use intellisense, that make i cannot add custom property to sprite object. Could you mind to tell me how to solve this problem ?
  8. I got a game class and various enemy classes. e.g. a class BasicGame.Enemy_1 = function(){ this.name = "Enemy_1"; this.hp = 10;};and BasicGame.Enemy_2 = function(){ this.name = "Enemy_2"; this.hp = 330;};in both classes sprite/image properties are also set for a game sprite to be created from these informations now in my game i want to collision detect my player and instances of the above enemies (1-n) for this i think i need a "group" of enemies, which can be achieved with this.enemies = game.add.group();so that i don't have to check each enemy instance collision on it's own. afterwards i'd like to add various enemy instances to this group and display them. the problem is, that only sprite/display objects could be added to groups. but when i only add the sprites, all my properties, like hitpoints, damage, aso. cant get read from the sprite itself. i thought that i could write a helper function to add all needed properties from the class to the sprite, but i didn't find a method "addProperty" for sprites (like there is one for groups - "setProperty") what's the best way to set the needed properties, which could be read from colliding objects aso.?
  9. according to the source: http://docs.phaser.io/World.js.html#sunlight-1-line-1461 convertCollisionObjects gets the properties // properties: json.layers[i].objects[v].properties,but does not do anything with it.. createBody would accept "options" int the 5th field but is using them to create the polygon. http://docs.phaser.io/World.js.html#sunlight-1-line-1378 var result = body.addPolygon(options, data);so this is not the way to go.. (because addPolygon is only taking 3 special options .. so i instead of using this (real game example:) collisionareas = game.physics.p2.convertCollisionObjects(map,"collisionareas");i am now using this: var collisionareas = []; var layer = "collisionareas" for (var i = 0, len = map.collision[layer].length; i < len; i++) { var object = map.collision[layer][i]; var body = game.physics.p2.createBody(object.x, object.y, 0, true, {} , object.polyline); body.properties = object.properties; if (body){ collisionareas.push(body);} }then i am able to access the properties set in tiled on my collisonareas (polylines) for (i=0; i<collisionareas.length; i++){ if (collisionareas[i].properties.action == 'ramp'){ collisionareas[i].onBeginContact.add(jumpOnRamp, this); } }now my question is: did i NOT see the obvious way how to do this or is this just not implementet (yet) and.. is this ok to do this or is it dangerous to use something like "body.properties" because it is used somewhere else and will cause me troubles later on? thx in advance!
  10. I'm having a bit of an issue figuring out tile properties in 1.1.5. My understanding is that each tile in a map has an individual set of properties, which can be set in the tile map editor such as Tiled. Here's what I'm doing, screenshots are of Tiled and my game objects being output to the Chrome developer console. I set the properties for each tile in the tileset in Tiled In my game, I can then see the tile properties at the Phaser.TileSet.tileProperties object, which I did not find on the documentation. But the tile properties are not available for each Phaser.Tile object Are the tile properties from the tile set not supposed to transfer to each individual tile object? I would like to be able to change the values for the properties on each tile as the game is played, so if not I suppose I'll need to set this up myself. Thanks!
  11. Hi, I would like to know if it is possible to create more properties for a sprite. For example, I'm creating a multiplayer game that is based on GPS, so I would like to assign a latitude and longitude to a sprite. So I would like to do it like this: sprite.latitude = value; sprite.longitude = value; Is this possible out of the box, or do I have to modify the phaser.js to achieve this? Thanks in advance, Kevin
  12. Hi all, Apologies for what is sure to be a noob question, but I'm trying to switch from Arcade physics to Ninja physics and finding some things that I expected to work properly are not - For instance, I enable a simple AABB physics object by basket = game.add.sprite(game.world.centerX, game.world.height - 100, 'basketimage');game.physics.ninja.enableAABB(basket);..which seems to give the object physics properties and it immediately falls offscreen due to gravity. I try and adjust properties such as basket.body.drag.x = 50;basket.body.maxVelocity.x = 250;basket.body.gravity.y = 0;... to no avail. I get error messages such as "Cannot set property 'y' of undefined Does anyone know what I'm doing wrong? Am I adding/enabling a physics body incorrectly? Thanks for your assistance.