Sign in to follow this  
Finwillwin

Animation Problem

Recommended Posts

Here is my issue:

Uncaught TypeError: Cannot read property 'getFrameIndexes' of null
    at i.AnimationManager.add (phaser.min.js:3)
    at Object.create (hub.js:45)
    at i.StateManager.loadComplete (phaser.min.js:3)
    at i.StateManager.preUpdate (phaser.min.js:3)
    at i.Game.updateLogic (phaser.min.js:3)
    at i.Game.update (phaser.min.js:3)
    at i.RequestAnimationFrame.updateRAF (phaser.min.js:3)
    at window.requestAnimationFrame.forceSetTimeOut._onLoop (phaser.min.js:3)

Here is my code:

if(game.spawn == 0){
player = game.add.sprite(500, 800, 'guy');
}
else if(game.spawn == 1){
player = game.add.sprite(1700, 1002, 'guy');
}

horn = 0;


    player.scale.setTo(1,1);
    game.physics.arcade.enable(player);
    player.body.collideWorldBounds = true;
    up = game.input.keyboard.addKey(Phaser.Keyboard.W);
    down = game.input.keyboard.addKey(Phaser.Keyboard.S);    
    left = game.input.keyboard.addKey(Phaser.Keyboard.A);
    right = game.input.keyboard.addKey(Phaser.Keyboard.D);
    y = game.input.keyboard.addKey(Phaser.Keyboard.Y);
    n = game.input.keyboard.addKey(Phaser.Keyboard.N);
    f = game.input.keyboard.addKey(Phaser.Keyboard.F);
    f.onDown.add(hub.gofull, this);
    q = game.input.keyboard.addKey(Phaser.Keyboard.Q);
    q.onDown.add(hub.show, this);
    game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;
    
    game.camera.follow(player, Phaser.Camera.FOLLOW_LOCKON, 0.1, 0.1);

    player.animations.add('right', [14,16], 6, true);
    player.animations.add('left', [20,22], 6, true);
    player.animations.add('down', [2,4], 6, true);
    player.animations.add('up', [10,8], 6, true);

 

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.