Commit 015df223 authored by haiyoucuv's avatar haiyoucuv

init

parent d92410fa
import { Assets, Container, PointData, Sprite, Ticker } from "pixi.js";
import { AnimatedSprite, Assets, Container, PointData, Sprite, Ticker } from "pixi.js";
import 'pixi.js/math-extras';
import { prefixInteger } from "@/utils/utils.ts";
export class Game extends Container {
......@@ -12,6 +13,17 @@ export class Game extends Container {
const bg = this.addChild(new Sprite(Assets.get("招财猫_底.png")));
bg.position.set(168, 332);
const textures = new Array(300).fill(0).map((_, i) => {
return Assets.get(`落金币/落金币_${prefixInteger(i, 5)}.png`);
});
const as = this.addChild(new AnimatedSprite(textures));
as.scale.set(0.66, 0.66);
as.anchor.set(0.5);
as.position.set(375, 553);
as.loop = false;
as.play();
const top = this.addChild(new Sprite(Assets.get("招财猫_叠.png")));
top.position.set(168, 332);
......
......@@ -10,8 +10,6 @@ const files = import.meta.glob(`../../../assets/Game/**/*`, {
eager: true,
});
console.log(files)
const bundleCfg = {
name: "Game",
assets: []
......@@ -26,7 +24,11 @@ for (const key in files) {
manifest.bundles.push(bundleCfg);
let inited = false;
export async function initBundle(): Promise<void> {
if (inited) return Promise.resolve();
console.time("initBundle");
await Assets.init({
manifest: manifest,
......@@ -37,4 +39,5 @@ export async function initBundle(): Promise<void> {
});
Assets.backgroundLoadBundle(["Game"]);
console.timeEnd("initBundle");
inited = true;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment