refactor(onitama): extract tweens into factory functions
Centralize Onitama animation logic by moving inline Phaser tweens into a dedicated `tweens.ts` configuration file. This improves reusability and cleans up spawners and renderers. Also updated documentation to warn against adding interruptions to looped tweens to prevent game logic hangs.
This commit is contained in:
@@ -9,11 +9,11 @@ import type Phaser from "phaser";
|
||||
import {
|
||||
COLORS,
|
||||
FONTS,
|
||||
ANIMATIONS,
|
||||
MENU_BUTTON,
|
||||
getBoardCenter,
|
||||
getCardLabelPosition,
|
||||
colorToStr,
|
||||
createWinnerPulseTween,
|
||||
} from "@/config";
|
||||
import { prompts } from "@/game/onitama";
|
||||
import {
|
||||
@@ -304,12 +304,6 @@ export class OnitamaScene extends GameHostScene<OnitamaState> {
|
||||
|
||||
this.winnerOverlay.add(winText);
|
||||
|
||||
this.tweens.add({
|
||||
targets: winText,
|
||||
scale: 1.2,
|
||||
duration: ANIMATIONS.winnerPulse,
|
||||
yoyo: true,
|
||||
repeat: 1,
|
||||
});
|
||||
createWinnerPulseTween(this, winText);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user