feat: zIndex
This commit is contained in:
parent
62f1584a42
commit
68b908ec43
|
@ -215,5 +215,6 @@ export default class Sprite extends Component {
|
||||||
source: {type: 'string'},
|
source: {type: 'string'},
|
||||||
speed: {type: 'float32'},
|
speed: {type: 'float32'},
|
||||||
tint: {defaultValue: 0xffffff, type: 'uint32'},
|
tint: {defaultValue: 0xffffff, type: 'uint32'},
|
||||||
|
zIndex: {defaultValue: 65535, type: 'uint16'},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,10 +106,17 @@ export default class Entity {
|
||||||
const {x, y} = this.entity.Position;
|
const {x, y} = this.entity.Position;
|
||||||
this.container.x = x;
|
this.container.x = x;
|
||||||
this.container.y = y;
|
this.container.y = y;
|
||||||
this.container.zIndex = y;
|
if (this.entity.Sprite?.zIndex === 65535) {
|
||||||
|
this.container.zIndex = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Sprite) {
|
if (Sprite) {
|
||||||
const {diffuse, normals} = this;
|
const {diffuse, normals} = this;
|
||||||
|
if (!this.attached || 'zIndex' in Sprite) {
|
||||||
|
this.container.zIndex = this.entity.Sprite?.zIndex === 65535
|
||||||
|
? this.entity.Position.y
|
||||||
|
: this.entity.Sprite.zIndex;
|
||||||
|
}
|
||||||
if (!this.attached || 'alpha' in Sprite) {
|
if (!this.attached || 'alpha' in Sprite) {
|
||||||
diffuse.alpha = normals.alpha = this.entity.Sprite.alpha;
|
diffuse.alpha = normals.alpha = this.entity.Sprite.alpha;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user