Commit c175e0dd authored by wildfirecode's avatar wildfirecode

1

parent a4c2b7bc
......@@ -78,7 +78,7 @@
</script>
<script src="output.js"></script>
<!-- <div id="debugCanvas" style="position:absolute;opacity: 1;pointer-events: none"></div> -->
<!-- <div id="debugCanvas" style="position:absolute;opacity: .3;pointer-events: none"></div> -->
</body>
</html>
\ No newline at end of file
......@@ -14,39 +14,25 @@ export default class StartSceneBase extends Scene {
htmlRuleBtn: eui.Button;
optionBtn: eui.Button;
recordBtn: eui.Button;
startBtn: eui.Button;
rankBtn: eui.Button;
elements: eui.Group;
countTxt: eui.Label;
exemptionTxt: eui.Label;
async start(data?) {
this.startBtn.visible = false;
this.updateGetInfoView();
this.updateExemptionTxt();
super.start();
}
async playAnimation() {
this.startBtn.horizontalCenter = 750;
this.countTxt.horizontalCenter = 750;
const btns = [this.ruleBtn, this.optionBtn, this.recordBtn, this.rankBtn];
btns.forEach(btn => btn.alpha = 0)
await wait(400);
egret.Tween.get(this.startBtn).to({ horizontalCenter: 0 }, 300, egret.Ease.backOut);
egret.Tween.get(this.countTxt).wait(100).to({ horizontalCenter: 0 }, 300, egret.Ease.backOut);
btns.forEach(btn => {
egret.Tween.get(btn).to({ alpha: 1 }, 700, egret.Ease.backOut);
});
await wait(500);
egret.Tween.get(this.startBtn, { loop: true })
.to({ scaleY: 1.1, scaleX: 0.9 }, 1000, egret.Ease.bounceOut)
.wait(500)
.to({ scaleY: 1, scaleX: 1 }, 1000)
.to({ scaleX: 1.1, scaleY: 0.9 }, 1000)
.to({ scaleX: 1, scaleY: 1 }, 1000);
}
private updateGetInfoView() {
......@@ -59,18 +45,9 @@ export default class StartSceneBase extends Scene {
}
async updateStartBtnStatus() {
if (this.startBtn) {
this.startBtn.visible = true;
this.startBtn.enabled = getStartBtnEnable();
}
}
updateCountTxt() {
if (this.countTxt) {
this.countTxt.text = getCountTxt();
}
}
updateExemptionTxt() {
......@@ -92,8 +69,6 @@ export default class StartSceneBase extends Scene {
this.optionBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_optionBtn, this);
if (this.recordBtn)
this.recordBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_recordBtn, this);
if (this.startBtn)
this.startBtn.once(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
if (this.rankBtn)
this.rankBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_rankBtn, this);
}
......@@ -112,21 +87,6 @@ export default class StartSceneBase extends Scene {
onTap_recordBtn(e: egret.Event) {
}
async onTap_startBtn(e?: egret.Event) {
egret.Tween.removeTweens(this.startBtn);
doStart();
egret.Tween.get(this.startBtn).to({ horizontalCenter: -750 }, 300);
egret.Tween.get(this.countTxt).to({ horizontalCenter: -750 }, 300);
const btns = [this.ruleBtn, this.optionBtn, this.recordBtn, this.rankBtn];
btns.forEach(btn => {
egret.Tween.get(btn).to({ alpha: 0 }, 300);
});
await wait(300);
egret.Tween.removeAllTweens();
SceneCtrl.instance.change(ModuleTypes.PLAY_SCENE);
}
onTap_rankBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.RANK_PANEL);
}
......
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload","version":5,"files":["../assets/startScene/start_btn.png","../assets/startScene/start_btn_gray.png"]}
\ No newline at end of file
{
"texture":"ballParticle.png",
"emitter":{"x":364,"y":458}
,"engGreenVariance":0
,"startRotation":-30
,"startBlue":255
,"endRedVariance":0
,"startRotationVariance":0
,"endRotation":0
,"startAlphaVariance":0
,"endSizeVariance":0
,"endRotationVariance":0
,"endGreen":255
,"gravity":{"x":0,"y":-150}
,"startRedVariance":0
,"speedVariance":0
,"endBlue":255
,"startBlueVariance":0
,"startAlpha":0.11764705882352941
,"endRed":255
,"radialAcceleration":0
,"endAlpha":1
,"startRed":255
,"radialAccelerationVariance":0
,"duration":-1
,"tangentialAcceleration":0
,"maxParticles":300
,"blendFactorDestination":"oneMinusSourceAlpha"
,"maxRadius":100
,"speed":10
,"maxRadiusVariance":30
,"lifespan":810
,"tangentialAccelerationVariance":0
,"minRadius":20
,"lifespanVariance":330
,"minRadiusVariance":10
,"startSize":50
,"startGreenVariance":0
,"rotatePerSecond":30
,"startSizeVariance":12.88
,"startGreen":255
,"rotatePerSecondVariance":10
,"endSize":15
,"emitterVariance":{"x":33,"y":16}
,"endBlueVariance":0
,"emitterType":0
,"blendFactorSource":"one"
,"emitAngle":70
,"endAlphaVariance":0
,"emitAngleVariance":360
,"blendMode":1
}
\ No newline at end of file
{"file":"fail.png","frames":{
"2":{"x":285,"y":585,"w":244,"h":259,"offX":276,"offY":307,"sourceW":750,"sourceH":750},
"3":{"x":614,"y":301,"w":280,"h":285,"offX":262,"offY":287,"sourceW":750,"sourceH":750},
"4":{"x":614,"y":0,"w":297,"h":299,"offX":253,"offY":278,"sourceW":750,"sourceH":750},
"5":{"x":310,"y":0,"w":302,"h":312,"offX":248,"offY":271,"sourceW":750,"sourceH":750},
"6":{"x":0,"y":0,"w":308,"h":306,"offX":242,"offY":273,"sourceW":750,"sourceH":750},
"7":{"x":285,"y":314,"w":280,"h":269,"offX":241,"offY":287,"sourceW":750,"sourceH":750},
"8":{"x":0,"y":308,"w":283,"h":276,"offX":241,"offY":283,"sourceW":750,"sourceH":750},
"1":{"x":913,"y":0,"w":67,"h":66,"offX":350,"offY":385,"sourceW":750,"sourceH":750}}}
\ No newline at end of file
{"file":"success.png","frames":{
"1":{"x":103,"y":230,"w":72,"h":9,"offX":337,"offY":438,"sourceW":750,"sourceH":750},
"2":{"x":0,"y":213,"w":101,"h":30,"offX":329,"offY":396,"sourceW":750,"sourceH":750},
"3":{"x":0,"y":150,"w":102,"h":61,"offX":324,"offY":324,"sourceW":750,"sourceH":750},
"6":{"x":106,"y":0,"w":101,"h":76,"offX":320,"offY":283,"sourceW":750,"sourceH":750},
"7":{"x":108,"y":78,"w":95,"h":78,"offX":323,"offY":275,"sourceW":750,"sourceH":750},
"8":{"x":104,"y":158,"w":88,"h":70,"offX":327,"offY":272,"sourceW":750,"sourceH":750},
"9":{"x":209,"y":0,"w":5,"h":5,"offX":0,"offY":0,"sourceW":750,"sourceH":750},
"5":{"x":0,"y":0,"w":104,"h":76,"offX":320,"offY":289,"sourceW":750,"sourceH":750},
"4":{"x":0,"y":78,"w":106,"h":70,"offX":319,"offY":306,"sourceW":750,"sourceH":750}}}
\ No newline at end of file
......@@ -5,7 +5,7 @@
"name": "rule"
},
{
"keys": "success_json,startscenebg_jpg,start_btn_png,start_btn_gray_png,ruleBtn_png,recordbtn_png,rankBtn_png,optionBtn_png,icecream_json,gift3_json,gift2_json,gift_json,fail_json,egg_json,donut_json,coin_json,candy2_json,candy_json,btnRight_png,btnLeft_png,boom_json,bg3_png,bg2_png,arrow_png",
"keys": "startscenebg_jpg,ruleBtn_png,recordbtn_png,rankBtn_png,optionBtn_png,icecream_json,gift3_json,gift2_json,gift_json,egg_json,donut_json,coin_json,candy2_json,candy_json,btnRight_png,btnLeft_png,boom_json,bg3_png,bg2_png,arrow_png",
"name": "start"
}
],
......@@ -80,66 +80,6 @@
"type": "image",
"name": "rankBtn_png"
},
{
"url": "assets/rank/bottomLine.png",
"type": "image",
"name": "bottomLine_png"
},
{
"url": "assets/rank/commonPanelBg.png",
"type": "image",
"name": "commonPanelBg_png"
},
{
"url": "assets/rank/num1.png",
"type": "image",
"name": "num1_png"
},
{
"url": "assets/rank/num2.png",
"type": "image",
"name": "num2_png"
},
{
"url": "assets/rank/num3.png",
"type": "image",
"name": "num3_png"
},
{
"url": "assets/rank/rankTitle.png",
"type": "image",
"name": "rankTitle_png"
},
{
"url": "assets/rank/userItemBg.png",
"type": "image",
"name": "userItemBg_png"
},
{
"url": "assets/rank/closeBtn.png",
"type": "image",
"name": "closeBtn_png"
},
{
"url": "assets/rank/dog.png",
"type": "image",
"name": "dog_png"
},
{
"url": "assets/particle3/ballParticle.json",
"type": "json",
"name": "ballParticle_json"
},
{
"url": "assets/particle3/ballParticle.png",
"type": "image",
"name": "ballParticle_png"
},
{
"url": "assets/particle3/firePot.png",
"type": "image",
"name": "firePot_png"
},
{
"url": "assets/startScene/startscenebg.jpg",
"type": "image",
......@@ -163,18 +103,6 @@
"name": "gift_json",
"subkeys": "1,10,2,3,4,5,6,7,8,9"
},
{
"url": "assets/startScene/success.json",
"type": "sheet",
"name": "success_json",
"subkeys": "1,2,3,4,5,6,7,8,9"
},
{
"url": "assets/startScene/fail.json",
"type": "sheet",
"name": "fail_json",
"subkeys": "1,2,3,4,5,6,7,8"
},
{
"url": "assets/startScene/btnRight.png",
"type": "image",
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="StartSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16705cb4eec"/>
<e:Image id="bg" source="startscenebg_jpg" x="0" y="0"/>
<e:Image id="arrow" source="arrow_png" x="373.97" y="1173.91" anchorOffsetX="275" anchorOffsetY="279" rotation="0"/>
<e:Image id="pipeline" source="bg3_png" y="0" horizontalCenter="0"/>
<e:Image id="fg" source="bg2_png" bottom="0" left="0"/>
<e:Button id="leftBtn" label="" y="1292.3" scaleX="1" scaleY="1" left="43" alpha="1">
<e:Group id="group" x="0" y="0">
<e:Image id="bg" source="startscenebg_jpg" x="0" y="0"/>
<e:Image id="arrow" source="arrow_png" y="1173" anchorOffsetX="275" anchorOffsetY="279" rotation="0" horizontalCenter="-2"/>
<e:Image id="pipeline" source="bg3_png" y="0" horizontalCenter="0"/>
<e:Image id="fg" source="bg2_png" left="0" bottom="0" visible="false"/>
</e:Group>
<e:Button id="leftBtn" label="" y="1292.3" scaleX="1" scaleY="1" left="43" alpha="1" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="btnLeft_png" source.down="btnLeft_png" source.disabled="btnLeft_png"/>
......@@ -13,7 +15,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="rightBtn" label="" y="1292.3" scaleX="1" scaleY="1" alpha="1" x="550.33">
<e:Button id="rightBtn" label="" y="1292.3" scaleX="1" scaleY="1" alpha="1" x="550.33" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="btnRight_png" source.down="btnRight_png" source.disabled="btnRight_png"/>
......@@ -22,17 +24,6 @@
</e:skinName>
</e:Button>
<e:Label id="exemptionTxt" text="*兑换项与活动均与设备制造商Apple Inc.公司无关*" width="100%" verticalAlign="middle" textAlign="center" size="18" y="1601" x="0" textColor="0x000000"/>
<e:Group horizontalCenter="0.5" verticalCenter="547">
<e:Button id="startBtn" label="" scaleX="1" scaleY="1" anchorOffsetX="152.5" anchorOffsetY="49.5" y="108.21" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="start_btn_png" source.down="start_btn_png" source.disabled="start_btn_gray_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label id="countTxt" text="1/1" width="100%" verticalAlign="middle" textAlign="center" y="183.39" horizontalCenter="0"/>
</e:Group>
<e:Button id="recordBtn" label="奖品记录" y="16" scaleX="1" scaleY="1" right="23" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled">
......
......@@ -3,10 +3,8 @@ import EgretRender from "../physics/EgretRender";
import getAngle from "../physics/utils/getAngle";
import getRotation from "../physics/utils/getRotation";
import check from "./check";
import { award, awardMask } from "./collisionConfig";
import createBox from "./createBox";
import createItems from "./createItems";
import DebugRender from "../physics/DebugRender";
export default class StartScene extends StartSceneBase {
_engine: Matter.Engine;
......@@ -35,8 +33,8 @@ export default class StartScene extends StartSceneBase {
//创建egret渲染
this.egretRenderContainer = new egret.Sprite();
this._egretRender = new EgretRender(this.egretRenderContainer, this._engine);
// this.once(egret.Event.ADDED_TO_STAGE, () => { this['group'].y = this.stage.stageHeight - 1624; }, this);
this.addChild(this.egretRenderContainer);
this.once(egret.Event.ADDED_TO_STAGE, () => { this['group'].y = this.stage.stageHeight - 1624; }, this);
this['group'].addChildAt(this.egretRenderContainer, 1);
// [this['basket_bottom'], this['basket_top'], this['glass']].forEach(item =>
// egret.Tween.get(item).set({ alpha: 0 }).to({ alpha: 1 }, 500));
......@@ -67,9 +65,10 @@ export default class StartScene extends StartSceneBase {
const { seesaw } = createBox(this);
this._seesaw = seesaw;
const reslist = ['boom', 'gift', 'gift2', 'candy', 'candy2',
const reslist = ['boom', 'gift', 'gift2', 'gift3', 'candy', 'candy2',
'coin',
'donut',
'egg',
'icecream']
await Promise.all(
reslist.map(res => RES.getResAsync(`${res}_json`))
......@@ -77,6 +76,9 @@ export default class StartScene extends StartSceneBase {
createItems(this);
let touchLeft = false;
let touchRight = false;
let angle = 0;
const ontick = () => {
const rotationLimit = 30;
if (touchLeft)
......@@ -86,59 +88,27 @@ export default class StartScene extends StartSceneBase {
let rotation = getRotation(angle);
if (rotation > rotationLimit) {
rotation = rotationLimit;
angle = getAngle(rotationLimit);
}
if (rotation < -rotationLimit) {
rotation = -rotationLimit;
angle = getAngle(-rotationLimit);
}
Matter.Body.setAngle(seesaw, getAngle(rotation));
return false;
}
let touchLeft = false;
let touchRight = false;
let angle = 0;
this.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN, (e: egret.TouchEvent) => {
touchLeft = e.stageX < 375;
touchRight = !touchLeft;
ontick();
egret.startTick(ontick, this);
}, this);
this.stage.addEventListener(egret.TouchEvent.TOUCH_END, (e: egret.TouchEvent) => {
egret.stopTick(ontick, this);
}, this);
Matter.Events.on(this._engine, 'beforeUpdate', () => {
// const isleft = 1;
// const start = isleft ? { x: 208, y: 821 } : { x: 549, y: 821 };
// const scale = 2.2;
// for (let i = 0; i < 15; i++) {
// setTimeout(() => {
// const r = random(10, 14);
// let bubblePic;
// bubblePic = createBubblePic(r);//默认球的尺寸100
// const basex = 0.02;
// const xoffset = 0.007;
// const fx = isleft ? random(-basex, basex) : random(-basex, basex);
// const padding = 50;
// const startx = random(start.x - padding, start.x + padding);
// if (fx < -xoffset || fx > xoffset) bubblePic = null;
// const body = this._egretRender.circle(startx, start.y, r, bubblePic,
// {
// density: 0.001 * 3,
// restitution: 1,
// force: { x: fx * scale, y: -0.02 * scale },
// collisionFilter: { group: bubbleGroup, category: bubble, mask: bubbleMask }
// }
// );
// setTimeout(() => {
// this._egretRender.remove(body);
// }, 1000);
// }, Math.random() * 200);
// }
});
[this['leftBtn'], this['rightBtn']].forEach(btn => {
btn.addEventListener(egret.TouchEvent.TOUCH_TAP, (e: egret.TouchEvent) => {
......
......@@ -7,7 +7,7 @@ const createBox = (_this: StartScene) => {
_this._egretRender.rectangle(750, 1624 / 2, 60, 1624, null, { isStatic: true, collisionFilter: { group: wall, category: wall, mask: wallMask } });
const seesaw = _this._egretRender.rectangle(375, 1174, 503, 70, _this['arrow'], {
const seesaw = _this._egretRender.rectangle(373, 1173, 503, 70, _this['arrow'], {
isStatic: true,
friction: 0,
collisionFilter: { group: basket, category: basket, mask: basketMask },
......
import { award, awardMask } from "./collisionConfig";
import createItem from "./items/createItem";
import StartScene from "./StartScene";
import LabelType from "./LabelType";
export default (_this: StartScene) => {
const startY = 984;
const startX = 100;
const forceScale = 7;
const leftStart = { x: startX, y: startY, forceX: 0.01 * forceScale };
const rightStart = { x: 750 - startX, y: startY, forceX: -0.01 * forceScale };
setInterval(() => {
const start = Math.random() > 0.5 ? leftStart : rightStart;
const size = 49*1.15;
const maxsize = 49;
const baseItem = createItem(size / maxsize);
let angle;
angle = 0;
const fallingCircle = _this._egretRender.circle(start.x, start.y, size / 2, baseItem,
// _this._egretRender.circle(375 + Math.random() * 200 - 100, 400 + 200 + 100, (size - 17) / 2, baseItem,
{
isStatic: false,
force: { x: start.forceX, y: 0 },
friction: 0,
restitution: .7,
collisionFilter: { group: award, category: award, mask: awardMask }
}
);
// const fallingCircle = Matter.Bodies.circle(start.x, start.y, 10 + Math.random() * 5, {
// isStatic: false,
// force: { x: start.forceX, y: 0 },
// friction: 0,
// restitution: 1,
// collisionFilter: { group: award, category: award, mask: awardMask }
// });
// const fallingRect = Matter.Bodies.rectangle(start.x, start.y, 50, 20, {
// isStatic: false,
// force: { x: start.forceX, y: 0 },
// friction: .5,
// restitution: .5,
// collisionFilter: { group: award, category: award, mask: awardMask }
// });
// (Matter.World.add(_this._engine.world, fallingCircle));
// Math.random() > 0.2 ? (Matter.World.add(this._engine.world, fallingCircle)) :
// (Matter.World.add(this._engine.world, fallingRect));
// const funcs = [createBoom, createIceCream, createDonut, createCandy2, createGift2, createGift3, createEgg];
// const types = [LabelType.Egg];
const types = [LabelType.Boom,LabelType.IceCream,LabelType.Donut,LabelType.Candy2,LabelType.Gift2,LabelType.Gift3,LabelType.Egg];
const i = Math.floor(Math.random() * types.length);
const type = types[i];
if (type == LabelType.Candy2) {
const forceScale = 15;
const leftStart = { x: startX, y: startY, forceX: 0.01 * forceScale };
const rightStart = { x: 750 - startX, y: startY, forceX: -0.01 * forceScale };
const start = Math.random() > 0.5 ? leftStart : rightStart;
const scale = 2;
const baseItem = createItem(scale, type);
_this._egretRender.rectangle(start.x, start.y, 49 * scale, 18 * scale, baseItem,
{
isStatic: false,
force: { x: start.forceX, y: 0 },
friction: 0,
restitution: 0.7,
collisionFilter: { group: award, category: award, mask: awardMask }
}
);
} else {
const forceScale = 7;
const leftStart = { x: startX, y: startY, forceX: 0.01 * forceScale };
const rightStart = { x: 750 - startX, y: startY, forceX: -0.01 * forceScale };
const start = Math.random() > 0.5 ? leftStart : rightStart;
const size = 49 * 1.15;
const maxsize = 49;
const baseItem = createItem(size / maxsize, type);
_this._egretRender.circle(start.x, start.y, size / 2, baseItem,
{
isStatic: false,
force: { x: start.forceX, y: 0 },
friction: 0,
restitution: .7,
collisionFilter: { group: award, category: award, mask: awardMask }
}
);
}
}, 1000);
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ import LabelType from "../LabelType";
const createCandy2 = (scale) => {
//气泡纹理种气泡的尺寸默认100(总体还包含气泡周围的阴影效果)
const texture = RES.getRes('candy2_json') as egret.SpriteSheet;
const animation = createMovieClip(texture, 0.6 * scale);
const animation = createMovieClip(texture, 98 / 137 * scale);
return animation
}
......@@ -17,7 +17,7 @@ const createMovieClip = (spritesheet: egret.SpriteSheet, scale = 1) => {
frames: list,
position: [0, 0],
scale: scale,
anchor: [.444, .44]
anchor: [199 / 500, 244 / 500]
});
movieclip.lable = LabelType.Candy2
return movieclip
......
......@@ -3,8 +3,8 @@ import LabelType from "../LabelType";
const createEgg = (scale) => {
//气泡纹理种气泡的尺寸默认100(总体还包含气泡周围的阴影效果)
const texture = RES.getRes('gift2_json');
const animation = createGiftMovieClip(texture, 1 * scale);//中间物体尺寸140px
const texture = RES.getRes('egg_json');
const animation = createGiftMovieClip(texture, 98/142 * scale);//中间物体尺寸140px
return animation
}
......@@ -17,7 +17,7 @@ const createGiftMovieClip = (spritesheet, scale) => {
frames: list,
position: [0, 0],
scale: scale,
anchor: [.444, .44]
anchor: [237/500,196/500]
});
movieclip.lable = LabelType.Egg
return movieclip
......
......@@ -4,20 +4,20 @@ import LabelType from "../LabelType";
const createGift2 = (scale) => {
//气泡纹理种气泡的尺寸默认100(总体还包含气泡周围的阴影效果)
const texture = RES.getRes('gift2_json');
const animation = createGiftMovieClip(texture, 1 * scale);//中间物体尺寸140px
const animation = createGiftMovieClip(texture, 98/87 * scale);//中间物体尺寸140px
return animation
}
const createGiftMovieClip = (spritesheet, scale) => {
const list = ['礼盒0000', '礼盒0001', '礼盒0002', '礼盒0003', '礼盒0004', '礼盒0005', '礼盒0006',
'礼盒0007', '礼盒0008', '礼盒0009', '礼盒0010', '礼盒0011', '礼盒0012', '礼盒0013', '礼盒0014', '礼盒0015'];
'礼盒0007', '礼盒0008', '礼盒0009', '礼盒0010', '礼盒0011', '礼盒0012', '礼盒0013', '礼盒0014', '礼盒0015'];
const movieclip = new MovieClip({
spritesheet: spritesheet,
frameInterval: 4,
frames: list,
position: [0, 0],
scale: scale,
anchor: [.444, .44]
anchor: [218 / 500, 229 / 500]
});
movieclip.lable = LabelType.Gift2
return movieclip
......
......@@ -3,8 +3,8 @@ import LabelType from "../LabelType";
const createGift3 = (scale) => {
//气泡纹理种气泡的尺寸默认100(总体还包含气泡周围的阴影效果)
const texture = RES.getRes('gift2_json');
const animation = createGiftMovieClip(texture, 1 * scale);//中间物体尺寸140px
const texture = RES.getRes('gift3_json');
const animation = createGiftMovieClip(texture, 98/87 * scale);//中间物体尺寸140px
return animation
}
......@@ -17,7 +17,7 @@ const createGiftMovieClip = (spritesheet, scale) => {
frames: list,
position: [0, 0],
scale: scale,
anchor: [.444, .44]
anchor: [218 / 500, 229 / 500]
});
movieclip.lable = LabelType.Gift3
return movieclip
......
......@@ -5,12 +5,18 @@ import createEgg from "./createEgg";
import createGift2 from "./createGift2";
import createIceCream from "./createIceCream";
import createGift3 from "./createGift3";
import LabelType from "../LabelType";
const createItem = (scale) => {
const funcs = [createDonut,createBoom,createIceCream];
// const funcs = [createBoom, createIceCream, createDonut, createCandy2, createGift2, createGift3, createEgg];
const i = Math.floor(Math.random() * funcs.length);
const mc = funcs[i](scale);
const createItem = (scale,type) => {
const datas = {};
datas[LabelType.Boom]=createBoom;
datas[LabelType.IceCream]=createIceCream;
datas[LabelType.Donut]=createDonut;
datas[LabelType.Candy2]=createCandy2;
datas[LabelType.Gift2]=createGift2;
datas[LabelType.Gift3]=createGift3;
datas[LabelType.Egg]=createEgg;
const mc = datas[type](scale);
return mc;
}
......
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