Jump to content

Search the Community

Showing results for tags 'nesting'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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

  1. I said it in another thread, but since that one was about another topic, I've decided to create a new specific thread. I try to nest one group into another: var a = game.add.group();var b = game.add.group();a.add(;but it fails (with an error in the console). The error shows in phaser.js at line 1556 (I'm using release 1.1.3): if(nextObject) { nextObject._iPrev = childLast; childLast._iNext = nextObject; }Is this by design or a bug? I'm trying to nest groups because, in my game, I already have a group that contains all items of the same kind and each of those items are group themselves (because I need to compose together two sprites animated by their spritesheet).
  2. I'm trying to do a board game in which the board tiles are "composed objects", i.e. each tile is made by an image + a colored background. I'm migrating my code from a DOM based rendering, where that task was really trivial: a div with a background color and an image within. I was thinking it would be easy to achieve the same with Phaser. My initial idea was to subclass Phaser.Sprite so to have a MyTile object able to have a texture composed by overlaying, in some way, some "tile.png" file over a colored background obtained through Phaser.Graphics, for example. I tried with BitmapData. Lot of problems even in trying to understand how to "render" an image on it. I made some try, then I read (from docs) that it's experimental and I decided to give up. I tried with RenderTexture and it worked in my sample code where I passed the RenderTexture instance directly to the Phaser.Sprite constructor or the game.add.sprite method. But refused to work in my game code where, having subclassed Phaser.Sprite, I had to set the sprite texture (i.e. the RenderTexture instance) only after object construction using the loadTexture method. I tried alot (my code is now full of commented parts with all the experiments) and achieved nothing. I really liked to do that with a single sprite, but failing on that I decided to use groups. My idea was to have a group for each tile and put, in each group, one Graphics for the colored background and one Sprite for the foreground image. No way: it seems that groups can't be nested... I made several (failing) tried until I reduced my code to the following: var a = view.game.add.group();var b = view.game.add.sprite();a.add(;...that of course fails. The error shows in phaser.js at line 1556 (I'm using release 1.1.3): if(nextObject) { nextObject._iPrev = childLast; childLast._iNext = nextObject; }because childLast (that was assigned from child.last some line before) is undefined. I was thinking that groups where like the containers in EaselJS (where I can nest them), but probably I'm misunderstanding their use. Now the only thing I think I can do is to produce a png image for each tile color for each tile kind (so if I have 20 tile kinds and 8 colors, I can reach the nice number of 160 images only for the tiles). Since I really don't want to do that, I'm here asking for help. Any suggestion?
×
×
  • Create New...