Jump to content

Tween animation slows down


Raptisha
 Share

Recommended Posts

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>

post-17595-0-09155200-1448628019.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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