Skip to content

Commit a5f7c45

Browse files
author
Julien Poulton
committed
Update Entity.java
1 parent 42aabdc commit a5f7c45

File tree

1 file changed

+6
-1
lines changed
  • engine/modules/entities/src/main/java/com/codingame/gameengine/module/entities

1 file changed

+6
-1
lines changed

engine/modules/entities/src/main/java/com/codingame/gameengine/module/entities/Entity.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ static enum Type {
2929
Entity() {
3030
id = ++GraphicEntityModule.ENTITY_COUNT;
3131
state = new EntityState();
32-
this.setVisible(true);
32+
33+
// World commits made before the creation of an entity should not affect that entity.
34+
// This is why we set `visible` to false by default and immediately setVisible(true),
35+
// this way the first commit of this entity will turn it into something visible.
36+
// All other properties have no impact while the entity is invisible so it is effectively non-existant until it's first commit.
37+
setVisible(true);
3338
}
3439

3540
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)