Jump to content

How to use DOM elements within the Phaser canvas


Regentix
 Share

Recommended Posts

Hello, i am new to using Phaser, and i would love to know if i am able to use DOM elements within my Phaser stage (canvas).

I have a div which is styled to look like a ball and i would like to use this ball in the phaser game to physicly bounce on any of the ledges i will define in the future.

My question: can i use this DOM element to do so? Or should i use a sprite/image? Because whenever the ball hits any of the ledges, i want it to change color. (I know this is possible with sprites and sprite recoloring)

Greetings, 

Regentix

Link to comment
Share on other sites

It's better to use Phaser sprites for that kind of thing. You can use DOM elements, and some people use it for UI and other static elements, but it makes more sense to use sprites for moving objects and items going on inside your game.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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