Raptisha Posted November 27, 2015 Share Posted November 27, 2015 Hello everyone! I an relatively new to Phaser. Recently I have tried to use tween animation and found an annoying glitch: my sprite moves up and down for a few seconds and then the animation slows down for a random number of seconds. it is not so smooth anymore, which bothers me a lot. Can you, please, help me to figure out the problem? Thank you in advance! here is the code: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Game</title> <style> body { padding: 0px; margin: 0px; } </style> <script src="js/library/phaser.min.js"></script></head><body> <script> var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update }); function preload() { game.load.spritesheet('player', 'assets/images/spaceship.png', 64, 29, 4); } function create() { this.player = game.add.sprite(0, 200, 'player'); this.game.add.tween(this.player).to({ y: this.player.y - 160 }, 300, Phaser.Easing.Linear.NONE, true, 0, Infinity, true); this.player.animations.add('fly', [0, 1, 2, 3, 2, 1]); this.player.animations.play('fly', 8, true); } function update() {} </script></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts