diff --git a/src/lib/player/objects/Line.ts b/src/lib/player/objects/Line.ts index 76bb74e..5247512 100644 --- a/src/lib/player/objects/Line.ts +++ b/src/lib/player/objects/Line.ts @@ -43,6 +43,7 @@ export class Line { private _yModifier: 1 | -1 = 1; private _rotationModifier: 1 | -1 = 1; private _rotationOffset: 0 | 180 = 0; + private _rotateWithParent: boolean = false; private _curX = []; private _curY = []; @@ -107,6 +108,7 @@ export class Line { : new GameObjects.Image(scene, 0, 0, this.getLineTexture(`asset-${lineData.Texture}`)); this._hasAttach = !!this._data.attachUI; + this._rotateWithParent = this._data.rotateWithFather ?? false; this._line.setScale( this._scene.p(1) * (this._scaleX ?? 1), (this._hasCustomTexture @@ -245,8 +247,7 @@ export class Line { else if (!this._hasCustomTexture && (!this._hasAttach || this._data.appearanceOnAttach === 2)) this._line.setTint(getLineColor(this._scene)); const { x, y } = this.getPosition(); - const rotation = - (this._rotationModifier * this._rotation + this._rotationOffset) * (Math.PI / 180); + const rotation = this.getRotation(); this._line.setPosition(x, y); this._line.setRotation(rotation); this._line.setAlpha(this._opacity / 255); @@ -363,6 +364,15 @@ export class Line { return { x, y }; } + getRotation() { + let rotation = this._rotationModifier * this._rotation + this._rotationOffset; + rotation *= Math.PI / 180; + if (this._parent !== null && this._rotateWithParent) { + rotation += this._parent.rotation; + } + return rotation; + } + createContainer(depth: number) { const container = new GameObjects.Container(this._scene); container.setDepth(depth); diff --git a/src/lib/types.ts b/src/lib/types.ts index 525ab4e..73d2125 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -110,6 +110,7 @@ export interface JudgeLine { eventLayers: (EventLayer | null)[]; extended?: Extended; father: number; + rotateWithFather?: boolean; isCover: number; isGif?: boolean; notes?: Note[];