Fedia Posted February 2, 2019 Share Posted February 2, 2019 How to call a function correctly checkDown ? Now it shows an error that this function was not found. main.js function checkDown() { if (CAN_CLICK) { CAN_CLICK = false; last_pointer_position.x = game.input.activePointer.worldX; last_pointer_position.y = game.input.activePointer.worldY; setTimeout(function () { CAN_CLICK = true; }, 200) } }; game = new Phaser.Game(_GLOBAL.Width, _GLOBAL.Height, Phaser.CANVAS, 'game'); game.state.add('menu', gameCreate); game.state.start('menu'); gameCreate.js var gameCreate = { preload: function () { } create: function() { var self = this; this.game.input.onDown.add(self.checkDown, this); } Link to comment Share on other sites More sharing options...
Davaaron Posted February 12, 2019 Share Posted February 12, 2019 You need to add the new javascript file to the index.html file like <script src="path/to/your/jsfile/jsfilename.js"></script> Link to comment Share on other sites More sharing options...
Recommended Posts