Creating Arcade Image and Sprite objects

The simplest way of creating an object with an Arcade physics body is by adding a Phaser.Physics.Arcade.Image or Phaser.Physics.Arcade.Sprite object to the scene. Both types are available in the Arcade section of the Blocks view:

Drop arcade image from blocks view.

When you drop it to the scene, it shows a dialog for selecting a texture:

Select the image's texture. A physics object in the scene.

Arcade game objects are generated in code with the image and sprite factories of the Arcade physics system:

// gorilla
const gorilla = this.physics.add.image(310, 313, "gorilla");
gorilla.body.setOffset(216, 58);
gorilla.body.setSize(186, 365, false);

The Arcade Image and Arcade Sprite game object types provide helper methods for configuring the physics body. However, you can enable an Arcade physics body in any other game object.

Updated on