File tree Expand file tree Collapse file tree 5 files changed +20
-4
lines changed
engine/modules/entities/src/main
java/com/codingame/gameengine/module/entities
resources/view/entity-module Expand file tree Collapse file tree 5 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 77 * This reduces artifacts caused by rounding errors at the cost of lower performance.
88 * </p>
99 */
10- public class BufferedGroup extends ContainerBasedEntity <BufferedGroup > {
10+ public class BufferedGroup extends ContainerBasedEntity <BufferedGroup > implements Mask {
1111 @ Override
1212 Entity .Type getType () {
1313 return Entity .Type .BUFFERED_GROUP ;
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ export class BufferedGroup extends ContainerBasedEntity {
77 initDisplay ( ) {
88 super . initDisplay ( )
99 this . buffer = new PIXI . Container ( )
10- this . buffer . sortableChildren = true
1110 this . gameTexture = null
1211 this . graphics = new PIXI . Sprite ( )
1312 this . needsRender = true
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ export class ContainerBasedEntity extends Entity {
1313 initDisplay ( ) {
1414 super . initDisplay ( )
1515 this . graphics = new PIXI . Container ( )
16- this . graphics . sortableChildren = true
1716 }
1817
1918 updateDisplay ( state , changed , globalData ) {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export const api = {}
66
77export class GraphicEntityModule {
88 constructor ( assets ) {
9+ window . entityModule = this
910 this . entities = new Map ( )
1011 this . frames = [ ]
1112 this . loadingAssets = 0
@@ -117,7 +118,6 @@ export class GraphicEntityModule {
117118 this . globalData . toPixel = ( WIDTH / canvasData . width ) * canvasData . oversampling
118119 this . globalData . mustResetTree = true
119120 api . container = this . container = container
120- container . sortableChildren = true
121121 this . entities . forEach ( ( e ) => {
122122 e . init ( )
123123 } )
@@ -167,6 +167,7 @@ export class GraphicEntityModule {
167167 e . childrenContainer . addChild ( child . container )
168168 child . parent = e
169169 } )
170+ this . sortContainerChildren ( e . childrenContainer )
170171 e . notifyChange ( )
171172 }
172173 } )
@@ -177,6 +178,13 @@ export class GraphicEntityModule {
177178 this . container . addChild ( e . container )
178179 }
179180 } )
181+ this . sortContainerChildren ( this . container )
182+ }
183+
184+ sortContainerChildren ( container ) {
185+ container . children . sort (
186+ ( a , b ) => a . zIndex === b . zIndex ? a . id - b . id : a . zIndex - b . zIndex
187+ )
180188 }
181189
182190 handleGlobalData ( players , globalData ) {
Original file line number Diff line number Diff line change 22
33The CodinGame SDK is regularly updated and improved. This document lets you know what changed in the latest releases.
44
5+ ## Next Release
6+
7+ ### 🎁 Features
8+
9+ - ` BufferedGroups ` can now be used as masks.
10+
11+ ### 🐞 Bug fix
12+
13+ - Children with equal ` zIndices ` are now rendered by order of insertion in ` Groups ` and ` BufferedGroups ` .
14+
515## 4.2.1
616
717### 🐞 Bug fix
You can’t perform that action at this time.
0 commit comments