Jump to content

onInputOver/onInputOut not working on group members.


christian.tucker
 Share

Recommended Posts

I know, I've posted a few questions here in a pretty quick link (Three in two days), and this should be one of my last ones. I just started with Javascript yesterday, but I already have a fairly decent platform, with a combat system in place, etc.

 

I wanted to move my HUD into a group, and have all of my buttons inside of it. The only problem was that as soon as I made the buttons part of the group, they no longer had hover functionality. 

 create: function() {        // Draw UI        hud = game.add.group();        hud.position.setTo(0, 496);        hud.create(0, 0, 'hud-bg');        hpBar = hud.create(270, 17, 'hp-fill');        expBar = hud.create(270, 41, 'exp-fill');        buttonA = hud.create(10, 32, 'phbutton', this.phClick, this, 2, 1, 0);        buttonA.onInputOver.add(this.phHoverIn, this);        buttonA.onInputOut.add(this.phHoverOut, this);    },    update: function() {    },    phClick: function() {    },    phHoverIn: function() {        buttonA.loadTexture('phbuttonhover', 0);    },    phHoverOut: function() {        buttonA.loadTexture('phbutton', 0);    }

If I however, create buttonA using Game.add.sprite instead of group.create()  the hover starts working again. 

 

I don't see anything in the documentation stating this: http://docs.phaser.io/Phaser.Group.html

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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