Sign in to follow this  
garry

what is the best way to add bunch of images

Recommended Posts

Hello, So I need to add like 500 images and this is How I'm doing it:

class CreateP extends PIXI.Container {
    constructor(id, x, y, width, height)  {
        super()

        this.id = id

        this.bla = PIXI.Sprite.fromImage(`blabla.png`) //images/textures are not same
        this.bla.anchor.x = 0.5;
        this.bla.anchor.y = 0.5;
        this.bla.x = x
        this.bla.y = y
        this.bla.width = width
        this.bla.height = height

        this.addChild(this.bla)
    }
}

module.exports = CreateP 

 

this.blas = new PIXI.Container();
this.stage.addChild(this.blas);
.
.
.
this.blas.addChild(new CreateP(id, x, y, width, height))  


now it kinda effects on performance pretty a lot, well I know this is a big number but I was wondering if there are some ways to improve the performance? maybe there is a better way to add these images?
 

1231194609_10-21-20187-36-13AM.png.c7c451702dfb8dfb88502b75c9f440ec.png

this doesn't seems normal to me. is this updateTransform and GC normal here? I mean I'm not changing anything about those sprites. they are already added
BTW the sprites never move or change or any thing. they just get destroyed after a while.

Could RenderTexture help here? I read the docs but honestly couldn't understand what is the purpose of it :)

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.