bbyford

Members
  • Content Count

    12
  • Joined

  • Last visited

About bbyford

  • Rank
    Member

Contact Methods

  • Website URL
    https://www.benbyford.com
  • Twitter
    benbyford

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. really cool, I didnt see anything to detect whether that named child exists or is attached to that object–you just using it knowing it does in this case?
  2. Thanks for baring with me @ivan.popelyshev coming from Unity3d land I've got a mental model of gameobjects which I need to either build into pixi i guess or let go of. I'll try and build a meta structure on top. Thanks!
  3. I guess this is my point. How do you add and remove things when you dont know what they are?! Whats the workflow for adding and removing objects as at the minute I have to add and then clear everything to add more stuff.
  4. ok cool, but if I assign a sprite a somesprite.name = someName and use getChildByName on it's container will bring it back? Or should i simply look after all my objects myself and just use pixi just to draw? or is it ok just to constantly add and remove things from the app.stage as i've been trying not to add and remove to often (e.g. in the Ticker).
  5. Been working with Pixijs for a month of so now and haven't found a good way of identifying sprites or containers in other containers. How do you get or adjust sprites and containers within containers? I'm been looking at: .getChildbyName but what name? And .getChildAt but how do i identify it amongst many other objects that could be returned? is there a design pattern I'm missing here, or a built in id for each created sprite that I can use to lookup or a name that I can assign? Cheers.
  6. this is great, thanks for the example. I will want to do something similar as I'll be adding and removing from the stage but reusing again later so not destroying.
  7. So I guess the anwser is, there is no best way. I want to kill everything on screen and re build, e.g. move to a new scene... this makes sense for how my mind is viewing the game and how pixi works, and I was hoping that there might be wisdom for a best case, or normal way of proceeding. This not the case then it sounds like someone (maybe me) needs to work it out and write a tutorial and its seems pretty basic to want to add and remove sprites and containers without them lingering on screen or having to do strange hacky things.
  8. I'm trying to remove sprites and containers from the current app.stage as to add new ones–e.g. change scene. However, both: let i = 0; app.stage.children.forEach(function(child){ app.stage.removeChild(i); i++; }); and app.stage.children.forEach(function(child){ child.destroy(true); }); remove the top level sprites but not the ones in a container?! Very strange. A second trigger of either of the above then removes them but I'd rather not trigger a function twice without working out why it's not working. I'm running pixi.js - v5.2.0
  9. AHHHHHHHHH thank you. I'm such a dick. Sometimes you just hit your head against a problem, and sometimes you've created that problem and can't see it
  10. Ok, so i simply can't get anything to register an event after having it previously working fine. Is there something global I might have done that stops these from happening?
  11. I'm adding a sprite in a loop, set interactive and then adding it to a container then the stage but my on events dont seem to be working, any reason why this might be happening? let map_asset_keys = Object.keys(map_assets_json); let length = map_asset_keys.length; let map_assets_arr = [] for (var key in map_assets_json){ let asset = new Sprite(Resources[key].texture); asset.x = map_assets_json[key].coords.x; asset.y = map_assets_json[key].coords.y; asset.zIndex = length; asset.setInteractive = true; asset.cursor = 'pointer'; asset.on('pointerdown', function(){alert()}) asset.tint = 0x550000; map_assets_arr.push(asset); --length; } let map_group = Groups.group(map_assets_arr); map_group.x = 0; map_group.y = 0; map_group.scale = new PIXI.Point(map_assets_scale * pixel_scale, map_assets_scale * pixel_scale); map_group.setInteractive = true; app.stage.addChild(map_group);
  12. I'm trying to work out how to log asset byte sizes after load. e.g. something like this: PIXI.Loader.shared.add("bg", "img/bg.png") .on("progress", loadProgressHandler); function loadProgressHandler(loader, resource) { console.log(resource.size); } This possible?