Hey i have a line of code that i dont understand[Solved]

Hey this is a line of code from a program that creates mummies but i dont understand this line can someone help.

game.add.tween(mummy).to({ x: game.width + (1600 + mummy.x) }, 20000, Phaser.Easing.Linear.None, true);

Sure,

This line tweens(moves) a sprite called mummy from the current x(px from left) position to the game’s width plus 1600 pixles plus the current x of the mummy. It does this tween in 20 seconds or 20,000 milliseconds. It uses no easing (smoothing of the tween or effects), and it starts the tween right away(the true on the end)

game.add.tween(mummy).to({ x: game.width + (1600 + mummy.x) }, 20000, Phaser.Easing.Linear.None, true);
game.add.tween(object_to_tween).to({ x: target_x }, time_in_milliseconds, easing, startNow);

object_to_tween:sprite or image

the {x:target_x} could be an object with a number of properties such as {x:100,y:200,alpha:0}
The tween will gradually adjust these values from the sprite’s current property to the target_values

Does that make sense?

1 Like

yes it does thank you very much this was very helpful