zarstar Posted September 10, 2014 Share Posted September 10, 2014 Is it normal that Sprites inside a SpriteBatch can't be interactive?I also tried to add a SpriteBatch in a DisplayObjectContainer for interactivity, but it doesn't work. Do you have any idea? Quote Link to comment Share on other sites More sharing options...
hubert Posted September 10, 2014 Share Posted September 10, 2014 Do you mean the sprite batch as the displayObjectContainer or every single sprite that is in it?! http://www.sevenative.com Quote Link to comment Share on other sites More sharing options...
zarstar Posted September 11, 2014 Author Share Posted September 11, 2014 the SpriteBatch as the DisplayObjectContainer.It's a subclass of DisplayObject so it should work, but it doesn't.The problem is that if you add it in another container it still doesn't work. Quote Link to comment Share on other sites More sharing options...
hubert Posted September 11, 2014 Share Posted September 11, 2014 Yup, spriteBatch is not interactive. Explaination here (same as for tinting - speed) https://github.com/GoodBoyDigital/pixi.js/issues/584 if you set it like this which is the correct way to use it on a normal sprite, the spriteBatch is not interactive.var container = new PIXI.SpriteBatch();container.setInteractive(true); container.click = function(){ alert('action'); };http://www.sevenative.com Quote Link to comment Share on other sites More sharing options...
Sebi Posted September 11, 2014 Share Posted September 11, 2014 You could alter the code and make it interactive.But the purpose of SpriteBatch is super fast rendering of many objects and to achieve that, everything else was sacrificed. Quote Link to comment Share on other sites More sharing options...
zarstar Posted September 11, 2014 Author Share Posted September 11, 2014 I solved using an overlay trasparent layer with buttons.It takes more time to create it, but buttons have alpha = 0, so they aren't rendered. Thank you guys for your support! Quote Link to comment Share on other sites More sharing options...
zarstar Posted September 11, 2014 Author Share Posted September 11, 2014 However I have the same problem another time, but this time would be too expensive to create an overlay transparent layer.So how could I change manually the PIXI code to let a SpriteBatch be interactive? Or, better, I need something like the HTML "map tag"... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.