Brunni Posted August 8, 2018 Share Posted August 8, 2018 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 More sharing options...
Quinten Posted August 8, 2018 Share Posted August 8, 2018 I think the problem might be that you are running javascript code as typescript. It's also not a good idea to deploy the node_modules folder to production. Link to comment Share on other sites More sharing options...
Brunni Posted August 9, 2018 Author Share Posted August 9, 2018 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 More sharing options...
Quinten Posted August 9, 2018 Share Posted August 9, 2018 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... Link to comment Share on other sites More sharing options...
Brunni Posted August 10, 2018 Author Share Posted August 10, 2018 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 More sharing options...
Quinten Posted August 10, 2018 Share Posted August 10, 2018 Glad you found it. Good luck with your project Link to comment Share on other sites More sharing options...
samme Posted August 11, 2018 Share Posted August 11, 2018 @Brunni all you need is phaser-ce/build/phaser.js. Link to comment Share on other sites More sharing options...
Recommended Posts