input-hit-area-circle.rst 834 B

123456789101112131415161718192021222324
  1. .. include:: ../_header.rst
  2. Circle Hit Area
  3. ~~~~~~~~~~~~~~~
  4. You can add a circular hit are to an object by seleting the ``CIRCLE`` shape in the **Hit Area** section. Then you can change the radius and position of the circle in the **Hit Area (Circle)** section:
  5. .. image:: ../images/scene-editor-input-hit-area-circle-20230517.webp
  6. :alt: Set the circle hit area.
  7. Also, you can change the circle properties with the **Edit Hit Area Tool** (``I``):
  8. .. image:: ../images/scene-editor-input-hit-area-circle-tool-20230517.webp
  9. :alt: Circle hit area tool.
  10. The |SceneCompiler|_ generates code for setting the circle area in this way:
  11. .. code::
  12. // wizball
  13. const wizball = this.add.image(191, 161, "wizball");
  14. wizball.setInteractive(
  15. new Phaser.Geom.Circle(46, 46, 46),
  16. Phaser.Geom.Circle.Contains);