goowik Posted March 22, 2016 Share Posted March 22, 2016 Sorry if the title isn't clear but can't seem to figure out how to write it. Let me explain: I have a group object which should contain 3 sprites (idle, highlight, reveal) can be considered as a button. The object is idle when nothing happens (idle sprite/image) The object goes into highlight mode (highlight sprite/image on top of idle sprite/image) when hovering The objects texture gets replaced by the reveal sprite/image when the object has been clicked. As for the sprites, I bundled each group of 3 images (idle, highlight, reveal) into 1 big image. To put this in code: var HiddenPlace = function(game, parent, options) { Phaser.Group.call(this, game, parent); this.revealed = false; // Create Base Spritesheet-object from atlas so a simple framenumber can be used var sprite = this.load('sprites', 'sym' + options.item+ '.png'); this.idleObj = this.create(options.x, options.y, sprite, 0); this.highlightObj = this.create(options.x, options.y, sprite, 1); this.highlightObj.alpha = 0; this.onReveal = new Phaser.Signal(); this.onHighlight = new Phaser.Signal(); this.removeHighlight = new Phaser.Signal(); }; I know this code wouldn't work but I hope you understand what I'm trying to achieve. Is that possible? Link to comment Share on other sites More sharing options...
drhayes Posted March 22, 2016 Share Posted March 22, 2016 Have you checked out Phaser.Button? It sounds like it'll handle exactly what you're looking for. Link to comment Share on other sites More sharing options...
Recommended Posts