Jump to content

Animation Problem


Finwillwin
 Share

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);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...