Jump to content

Event/Input Executes when defined


justinboyd5
 Share

Recommended Posts

Hey Everyone,

I hope someone could help me with this, or if anyone has run into this issue before.
 
I've noticed when I add a signal to an extended sprite, it will be executed immediately. Has anyone run into this issue before?
 

var Card = function(game, x, y, data){    Phaser.Sprite.call(this, game, x, y, 'cardFront');    this.cardName = data.cardName || null;  // String    this.scale.setTo(0.15,0.15);};Card.prototype = Object.create(Phaser.Sprite.prototype);Card.prototype.constructor = Card;var card = new Card(this.game, 0, 0, {name:'test'});card.input.useHandCursor = true;card.events.onInputOver.add(highlightCard, this, 0, 'arg1', 'arg2');HighlightCard = function(sprite, pointer, arg1, arg2){   console.log('highlight:', sprite, pointer, arg1, arg2);};

 
Thank you!

Link to comment
Share on other sites

Thanks lewster32!

 

I found the problem I was having. The sprite I was using was huge and I was scaling it down as it gets created. Since the sprite was so large it covered the entire game world. This caused my onInputOver to trigger even when the sprite was scaled down. It's pretty minor but should I open a bug for this?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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