Brunni

Cannot get buttons to work on Phaser-CE

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Also there seems to be something wrong with your setup. When you run ‘npm run build’ it creates a +8mb file that seems to way to big. The problem will be somewhere in there, but it is hard to tell because the file is so large...

Share this post


Link to post
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>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.