Jump to content

Cannot get buttons to work on Phaser-CE


Brunni
 Share

Recommended Posts

I've tried to get buttons to work using code shown here: https://phaser.io/examples/v2/buttons/action-on-click

I've entirely copied the code into my project (under `index.ts`) and it has nothing more, still the button doesn't react, nor are the events triggered.

My project is a simple setup with phaser-ce and webpack. I've attached it (just run `npm install`, then `npm run server`). I cannot get why this wouldn't work. Apparently, the `pointerdown` and other events on the DOM are triggered and pass through Phaser, but for some reason it won't dispatch them to my button.

Any idea?

Thanks :)

nonworking-phaser-ce-touch-events.7z

Link to comment
Share on other sites

Hmm not sure what you're saying about the `node_modules` folder but I'm not in production for now :)

I really don't think TypeScript has anything to do here. I could start a project from zero some time, but before that I'm curious if it's normal that I can't get Input to work.

Link to comment
Share on other sites

So for what it's worth, the problem was apparently in the order of .js files in `index.html`. This is the right one, not the one in my file (phaser first). Thanks for your time, and I'll review my template ;)

<script src="node_modules/phaser-ce/build/custom/pixi.js"></script>
<script src="node_modules/phaser-ce/build/custom/p2.js"></script>
<script src="node_modules/phaser-ce/build/phaser.min.js"></script>
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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