You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 23:16:20 +00:00
🆙 Added animated gif to badge_display
Display Container
├── Furniture Container (renders 1st - back)
│ └── All furniture sprites sorted by z-depth
├── Avatar Container (renders 2nd - middle)
│ └── All avatar sprites sorted by z-depth
└── Badge Container (renders 3rd - front)
└── All badge sprites sorted by z-depth
✅ Badges render on top of their furniture
✅ Avatars respect proper 3D depth (in front when in front, behind when behind)
✅ Animated GIFs work beautifully
✅ Clean, maintainable code with just a tiny z-offset
This commit is contained in:
@@ -455,14 +455,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
sortableSprite.x = (spriteX - this._screenOffsetX);
|
||||
sortableSprite.y = (spriteY - this._screenOffsetY);
|
||||
sortableSprite.z = ((z + sprite.relativeDepth) + (3.7E-11 * count));
|
||||
|
||||
let calculatedZ = ((z + sprite.relativeDepth) + (3.7E-11 * count));
|
||||
|
||||
// Ensure badge renders on top of furniture
|
||||
const isBadgeSprite = (sprite.tag === 'BADGE');
|
||||
|
||||
if(isBadgeSprite) {
|
||||
sortableSprite.z = -999;
|
||||
}
|
||||
if(isBadgeSprite)
|
||||
{
|
||||
calculatedZ = calculatedZ + 0.001;
|
||||
}
|
||||
|
||||
sortableSprite.z = calculatedZ;
|
||||
|
||||
spriteCount++;
|
||||
count++;
|
||||
|
||||
@@ -10,6 +10,8 @@ export class SortableSprite implements ISortableSprite
|
||||
private _x: number;
|
||||
private _y: number;
|
||||
private _z: number;
|
||||
private _isBadge: boolean;
|
||||
private _isAvatar: boolean;
|
||||
|
||||
constructor()
|
||||
{
|
||||
@@ -19,12 +21,16 @@ export class SortableSprite implements ISortableSprite
|
||||
this._x = 0;
|
||||
this._y = 0;
|
||||
this._z = 0;
|
||||
this._isBadge = false;
|
||||
this._isAvatar = false;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
this._z = -(SortableSprite.Z_INFINITY);
|
||||
this._sprite = null;
|
||||
this._isBadge = false;
|
||||
this._isAvatar = false;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
@@ -76,4 +82,24 @@ export class SortableSprite implements ISortableSprite
|
||||
{
|
||||
this._z = z;
|
||||
}
|
||||
}
|
||||
|
||||
public get isBadge(): boolean
|
||||
{
|
||||
return this._isBadge;
|
||||
}
|
||||
|
||||
public set isBadge(value: boolean)
|
||||
{
|
||||
this._isBadge = value;
|
||||
}
|
||||
|
||||
public get isAvatar(): boolean
|
||||
{
|
||||
return this._isAvatar;
|
||||
}
|
||||
|
||||
public set isAvatar(value: boolean)
|
||||
{
|
||||
this._isAvatar = value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user