Button in Phaser doesn't work

Recommended Posts



I have a code, just a button created via Phaser:

module.exports = {

init: function() {
closeButton = game.add.button(w/1.47, h/1.272, 'close', this.closeProfile, this);
closeButton.fixedToCamera = true;
closeButton.inputEnabled = true;

closeProfile: function() {
close.key = 'img/profile/closePress.png';

Module.exports - this is Browserify

in the main file there is another code:

window.game = new Phaser.Game((h > w) ? h : w, (h > w) ? w : h, Phaser.CANVAS, 'game', {render:render});

var ship;
var cursors;
var sun1;
var rc;
var space;

var profile;
var closeButton, holdLeft, holdRight, avaProfile;

game.state.add('Boot', require('./states/boot.js'));
game.state.add('Play', require('./states/play.js'));

And button doesn't call a function at all

I really can't get it!

I will appreciate your help

Thanks in advacne!

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.