Hide everything outside of stage

82 views
Skip to first unread message

Shaun Michael K. Stone

unread,
Aug 15, 2015, 8:19:59 AM8/15/15
to HaxeFlixel
Is there a way to do this? So anything outside of the bounds of the stage is hidden/cut off.

Emin Fedar

unread,
Aug 15, 2015, 10:34:05 AM8/15/15
to HaxeFlixel
You can create grids. For example : every 1000x1000 can be grid. You can handle it like this : grids[0][0] -> 0x0 - 1000x1000 grid. If an object in this grid (you can calculate this by Math.floor(controlobject.x/1000) ) you will add it to grid[0][0] array (dynamic).

set visible value false in objects in other grids. 

15 Ağustos 2015 Cumartesi 15:19:59 UTC+3 tarihinde Shaun Michael K. Stone yazdı:

SruloArt

unread,
Aug 15, 2015, 2:29:34 PM8/15/15
to haxef...@googlegroups.com
* Checkout FlxG.worldBounds. By default stuff outside of it won't overlap-collide (quadTree). You can use FlxObject.inWorldBounds() to kill objects that are outside of it (as mentioned in the method's description).

* Also, objects outside of their camera's width/height (not the same as the worldBounds necessarily) won't be drawn (checkout .isOnScreen(), but FlxObject and FlxSprite have a different version of it).
Reply all
Reply to author
Forward
0 new messages