Sign in to follow this  
Followers 0
html5gamedev

getting baseTexture.once is not a function, but the code works

2 posts in this topic

I am creating animation frames from image the hard way -I am using PIXI.Texture and passing baseTexture and Rectangle (I don't use json directly, because of reusability of json instructions). See code below. I am getting an error: baseTexture.once is not a function. I don't know what is causing this error, but the animation is working as expected. Is this error something I shouldn't worry?

 

 

function loadAssets() {
    PIXI.loader
        .add('first', 'assets/first.png')
        .load(function (loader, resources){
        onLoaded(loader, resources)
    });
}



function onLoaded(loader, resources) {
    console.log(resources.rot1.texture.baseTexture);// all rotations loaded 
    var first = new PIXI.extras.AnimatedSprite(createFrames(resources["first"].texture.baseTexture));

....

}



function createFrames(name) {
    var frames = [];
    for (var i = 0; i < 39; i++) {
            var rect = new PIXI.Rectangle(arr[i].frame.x, arr[i].frame.y, arr[i].frame.w, arr[i].frame.h); // stored in an array generated from json

        frames.push(new PIXI.Texture(name, rect));
    }
    return frames;
}

 

Share this post


Link to post
Share on other sites

ah, I am such a noob. there was some test code somewhere else in the project. you can safely delete this thread.

 

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.