In the Phaser 3 docs I can see that the biggest difference between Sprite
and Image
is that you cannot animate or add a physics body to an Image
, but in Image
properties you can see an animationManager. I'm a little confused about this. Can anyone clarify this?
A Sprite Game Object is used for the display of both static and animated images in your game. Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled and animated. The main difference between a Sprite and an Image Game Object is that you cannot animate Images.
Give this a try: var config = { type: Phaser. AUTO, width: 600, height: 800, physics: { default: 'arcade', arcade: { gravity: {y: 500}, debug: false } }, scene: { preload: preload, create: create, update: update } }; That should load your first scene with the functions you have created.
Actually, according to the official docs Phaser.GameObjects.Image
does not have a AnimationManager
property.
Phaser.GameObjects.Sprite
on the other hand does have an anims
that can access animations, but doesn't include a direct property of type AnimationManager
. Both can be confirmed by using the TypeScript defintions.
This is because AnimationManager
is global, and handles all animations. In Phaser 2 all objects would handle their own animations. See for example Phaser 2 CE's Phaser.Image
docs.
So just as the documentation says, Image
is effectively a static, lighter-weight, Sprite
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With