Skip to content

Commit

Permalink
キーフラッシュのアニメーションを以前と同じ見た目になるように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
3w36zj6 committed Nov 9, 2023
1 parent 72f8120 commit 34f1f23
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/scene/PlayScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class PlayScene extends Phaser.Scene {
private judgeText: Phaser.GameObjects.Image
private judgeFSText: Phaser.GameObjects.Image

private readonly keyFlashes: Phaser.GameObjects.Image[]
private keyFlashImages: Phaser.GameObjects.Image[]

private jacketImage: Phaser.GameObjects.Image

Expand Down Expand Up @@ -275,6 +275,7 @@ export class PlayScene extends Phaser.Scene {
.setAlpha(1)
.setScale(0.5)

this.keyFlashImages = []
this.keyFlashTweens = []
this.holdParticleEmitters = []
this.inputZones = []
Expand Down Expand Up @@ -303,14 +304,22 @@ export class PlayScene extends Phaser.Scene {
} else if (this.playConfig.key == 7) {
positionX = 322 + 106 * laneIndex
}
this.keyFlashImages.push(
this.add
.image(positionX, 720, "key-flash")
.setOrigin(0.5, 1)
.setDisplaySize((900 / this.playConfig.key) * 0.81, 720)
.setVisible(false)
.setDepth(-2),
)

this.keyFlashTweens.push(
this.tweens.add({
persist: true,
targets: this.add
.image(positionX, 720, "key-flash")
.setOrigin(0.5, 1)
.setDisplaySize((900 / this.playConfig.key) * 1.02, 720)
.setDisplaySize((900 / this.playConfig.key) * 0.81, 720)
.setDepth(-2),
scaleX: { value: 0, duration: 80, ease: "Linear" },
ease: "Quintic.Out",
Expand Down Expand Up @@ -351,6 +360,7 @@ export class PlayScene extends Phaser.Scene {
})
.on("pointerout", () => {
this.isTouching[laneIndex] = false
this.keyFlashTweens[laneIndex].restart()
}),
)
this.keyLabels.push(
Expand Down Expand Up @@ -577,7 +587,9 @@ export class PlayScene extends Phaser.Scene {
if (this.keys !== null) {
for (const laneIndex of Array(7).keys()) {
if (this.keys[laneIndex].isDown || this.isTouching[laneIndex]) {
this.keyFlashTweens[laneIndex].restart()
this.keyFlashImages[laneIndex].setVisible(true)
} else {
this.keyFlashImages[laneIndex].setVisible(false)
}
}
}
Expand All @@ -599,12 +611,16 @@ export class PlayScene extends Phaser.Scene {
this.hasFadedOut = true
}

// key down
if (this.keys !== null) {
for (const laneIndex of Array(7).keys()) {
// key down
if (Phaser.Input.Keyboard.JustDown(this.keys[laneIndex])) {
this.judgeKeyDown(laneIndex)
}
// key up
if (Phaser.Input.Keyboard.JustUp(this.keys[laneIndex])) {
this.keyFlashTweens[laneIndex].restart()
}
}
}

Expand Down

0 comments on commit 34f1f23

Please sign in to comment.