Sign in to follow this  
html5gamedev

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

Recommended Posts

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.