jaevelgames Posted February 2, 2015 Share Posted February 2, 2015 Hi! What would be the easiest way to check if a sprite (bullets, for example) is within the stage, and if not remove them? I guess I could check the x and y-properties of every single sprite, and if it's less or more than the stages width and height = remove. But that doesn't seem optimal.. Thanks! Quote Link to comment Share on other sites More sharing options...
xerver Posted February 2, 2015 Share Posted February 2, 2015 I guess I could check the x and y-properties of every single sprite, and if it's less or more than the stages width and height = remove. But that doesn't seem optimal.. That's pretty much it, in your update loop do culling checks. In fact, that is exactly what Phaser does. Quote Link to comment Share on other sites More sharing options...
jaevelgames Posted February 3, 2015 Author Share Posted February 3, 2015 Haha, okay.. I've never used Phaser before and was hoping not to at this moment. But perhaps I'll give it a try.. Thanks though! Quote Link to comment Share on other sites More sharing options...
xerver Posted February 3, 2015 Share Posted February 3, 2015 Haha, okay.. I've never used Phaser before and was hoping not to at this moment. But perhaps I'll give it a try.. Thanks though! Don't necessarily need to use phaser, but you have the right idea of how to do culling. 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.