Commit 2b7e615e authored by haiyoucuv's avatar haiyoucuv

111

parent 19b56259
This diff is collapsed.
......@@ -2,27 +2,67 @@ import IEffect from "../../IEffect";
import { PLANT_STATE, PLANT_TYPE } from "../../../const/staticData";
import { RES } from "../../../../module/RES";
import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import Container = FYGE.Container;
import { Tool } from "../../../Tools";
export class BirthEffect extends Sprite implements IEffect {
export class BirthEffect extends Container implements IEffect {
private type: PLANT_TYPE;
private _type: PLANT_TYPE;
private _state: PLANT_STATE;
private img: Sprite;
public get type(): PLANT_TYPE {
return this._type;
}
public get state(): PLANT_STATE {
return this._state;
}
private sprites = [];
constructor(type: PLANT_TYPE, state: PLANT_STATE) {
super(RES.getRes(`${type}${state}.png`));
super();
const pos = [
[10, 10],
[50, 50],
[60, 60],
[70, 70]
];
[0, 1, 2, 3].forEach((v) => {
const n = this.addChild(Tool.getSprite(`${type}_${state}.png`));
n.anchorTexture.set(0.5, 1);
n.scale.set(0, 0);
n.position.set(pos[v][0], pos[v][1]);
this.sprites.push(n);
});
}
public play() {
// 中心点在树根下方,每次记得对一下
// 缩放:0s(0%,0%)-0.23s(110%,110%)-0.33s(100%,100%);
// 位置:0s(原位)-0.23s(上移10px)-0.33s(下移10px至原位);
this.stop();
this.sprites.forEach((v) => {
const _y = v.y;
Tween.get(v)
.to({scaleX: 1.1, scaleY: 1.1, y: _y - 10}, 230, Ease.quadIn)
.to({scaleX: 1, scaleY: 1, y: _y}, 100, Ease.quadOut);
});
}
public reset() {
this.stop();
this.sprites.forEach((v) => {
v.scale.set(0, 0);
});
}
public stop() {
this.sprites.forEach((v) => {
Tween.removeTweens(v);
});
}
}
......@@ -3,8 +3,8 @@ import { Tool } from "../Tools";
import GameLayer from "../parts/Game/GameLayer";
import { UILayer } from "../parts/UI/UILayer";
import { Land } from "../parts/Game/Land";
import OptionPool from "../const/OptionPool";
import { OPTION_TYPE } from "../const/staticData";
import { PLANT_STATE, PLANT_TYPE } from "../const/staticData";
import { BirthEffect } from "../parts/Game/Effects/BirthEffect";
import MouseEvent = FYGE.MouseEvent;
export class GameScene extends Scene {
......@@ -34,7 +34,8 @@ export class GameScene extends Scene {
// UI层
this.uiLayer = this.addChild(new UILayer());
window['a'] = this.addChild(OptionPool.ins.takeOut(OPTION_TYPE.GET));
window['a'] = this.addChild(new BirthEffect(PLANT_TYPE.Sunflower, PLANT_STATE.STATE1));
window['a'].position.set(200, 600);
}
......
......@@ -77,7 +77,7 @@ export class LoadingScene extends Scene {
private startLoading() {
return Tween.get(this.progressFill)
.to({x: 10}, 2000, Ease.quadInOut);
.to({x: 10}, 1000, Ease.quadInOut);
}
private titleEffect() {
......
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