Skip to content

Commit 1e06742

Browse files
NaejDoreeJean Poree
authored andcommitted
feat(entity-module): adding an api to hide an entity
1 parent 1c4ffb5 commit 1e06742

File tree

1 file changed

+6
-1
lines changed
  • engine/modules/entities/src/main/resources/view/entity-module

1 file changed

+6
-1
lines changed

engine/modules/entities/src/main/resources/view/entity-module/Entity.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ export class Entity {
3030
}
3131
}
3232

33+
setHidden (hide) {
34+
this.hide = hide
35+
this.container.visible = this.currentState.visible && !this.hide
36+
}
37+
3338
addState (t, params, frame) {
3439
if (!this.states[frame]) {
3540
this.states[frame] = []
@@ -143,7 +148,7 @@ export class Entity {
143148
this.container.position.set(state.x * globalData.coeff, state.y * globalData.coeff)
144149
this.container.scale.set(state.scaleX || eps, state.scaleY || eps)
145150
this.container.rotation = state.rotation
146-
this.container._visible = state.visible
151+
this.container._visible = state.visible && !this.hide
147152
}
148153

149154
static createState (time = 1, values = {}, curve = {}) {

0 commit comments

Comments
 (0)