Search the Community

Showing results for tags 'index'.



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

  1. I'm trying to load an atlas created with TexturePacker using: PIXI.loader .add("game", "assets/sprites/game.json") .add("ui", "assets/sprites/ui.json") .on("progress", loadProgress) .load(setup); But for some reason pixi seems to be indexing the loaded assets by incremental numeric id instead of using the labels contained in the respective json files. Because of this I'm getting index collision when loading more than one atlas. Anyone know why? Another question, how hard it is to write a custom loader. I'm trying to import animations from ToonBoom which uses a specific xml format. I want to load it automatically as with the TexturePacker atlas.
  2. I'm creating a game with many types of tiles. Each tile type has different properties that I'm customizing: it's texture, layering, and collision. These are all determined separately. In the interest of making my P2 life easy, I have two tile groups, collision and no-collision. The tiles that collide with the player are placed in one and the others go into the other. The problem is, as I mentioned before, my game is pretty layering-intensive. As of right now I haven't found a way to have individuals tiles within a group have an index independent of their parent group's. This makes sense of course, especially when you're familiar with the Pixi renderer. That doesn't really solve my problem however. Does anyone know of a way in which I can keep my collision groups separate from my layering? I would love, love, love if Phaser 3 had some sort of Z-index setter as well- manipulating everything through bringToTop() is pretty difficult.
  3. hi buddies, im beginning whit this marvelous framework called PHASER. believe me i read the docs and everything in theory works fine. but in my code something is not working. lets see; i've been working with groups this.group1 = game.add.group(); this.group2 = game.add.group(); this.group1.enableBody = true; this.group2.enableBody = true; this.group1.create(0, 20, "coin"); this.group2.create(20, 50, "enemy"); ////parent group this.enemies = game.add.group(); this.enemies.enableBody = true; this.enemies.addAt(this.group1,0); this.enemies.addAt(this.group2,1); here the parent group contents two child group at index 0 and 1 respectively. but i cant understand why when i assign the child stored in index 0, also the index 1 is been used. this.enemies.forEach(this.dd,this); dd: function(enemypp) { selectedEnemy = enemypp.enemypp.getAt(0); selectedEnemy.body.velocity.x = 60; } the output........ TWO sprites moving to the right at 60. why??? i understand im using a foreach and it iterartes the parent group, but is there a way to tell phaser to kindly only move the sprite which index is 0? i tried using a if clause, but i dont know how to choose the first item, maybe by its name??? i dont know its syntax maybe something like if(selectedEnemy.name == "group1").... help me please i want to continue using this incredible framework.
  4. Hey! I was wondering how I could loop over indices of a phaser group with sprites. The order of the sprites is important, because I would like to add a different 'pause screen' when an enemy is caught. In that pause screen I would like to show a certain piece of text which corresponds to the index of the enemy caught (they are 10 vows of our company). Currently I'm just listing them all seperated, but that's of course not the best way to do it. I'm still learning a lot, I find loops and getting my code clear not the easiest things So right now I'm just doing this: if (!enemyGroup.getAt(0).alive) {this.managePause1();}if (!enemyGroup.getAt(1).alive) {this.managePause2();}etc. Thanks in advance!
  5. I need to get the tile index of a concrete Tile of my map. I write this: console.log(map.getTile(xBlock, yBlock, layer2, true)); and I get: But if I write console.log(map.getTile(xBlock, yBlock, layer2, true).properties); I get an empty Object. If the index property exist why can't I get it? I don't find another method for this. Thanks.
  6. I'm working on a game where the player controls a rotating vehicle which can collide with enemies and coins. I'm aware that the sprite body (aka "hit area") can only be a rectangle and it cannot be rotated. So instead, I've created 3 separate invisible sprites that only serve as hit detection areas. These hit areas rotate around the player's axis as the player rotates and this all works fine. See image and github code below, it's just test code where the plane follows the mouse cursor and you can rotate it with the cursor keys:https://github.com/BdR76/phasercollision My question is this:I'm wondering if there is a more efficient way to do this. Is there a way to access the sprites in a group like playerHitGroup.sprites[0] and playerHitGroup.sprites[1] etc.? That way I could just create the sprites in a for-loop and I wouldn't have to keep 3 separate vars for the sprites like the code is now:var dum1;var dum2;var dum3;// setup the player hit spritesdum1 = game.add.sprite(0, 0, null, 0, playerHitGroup);dum1.body.setSize(32, 32);dum1.anchor.setTo(0.5, 0.5);dum2 = game.add.sprite(0, 0, null, 0, playerHitGroup);dum2.body.setSize(32, 32);dum2.anchor.setTo(0.5, 0.5);dum3 = game.add.sprite(0, 0, null, 0, playerHitGroup);dum3.body.setSize(32, 32);dum3.anchor.setTo(0.5, 0.5);