Commit 77f8872c authored by 汪欢's avatar 汪欢

addother

parent b0afd988
......@@ -47,8 +47,7 @@ function launchWithCustomModule(customModule) {
setTimeout(() => {
engine.globalEvent.dispatchEvent('pictures-start', {
picUrl: "//yun.duiba.com.cn/aurora/assets/f57e4cbfe6bb27333c8d53ed1031624c4e0500aa.pnghttp://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png",
blockUrl: "c9ff7c30-2734-417d-a811-d88b6b7140b8",
});
// const d = engine.gameStage.sceneContainer.getChildAt(0);
......
......@@ -7,6 +7,11 @@
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var Human = (function (_super) {
......@@ -32,6 +37,27 @@
Human.prototype.removeFace = function (face) {
this.human.removeChild(face);
};
Human.prototype.scaleEffect = function () {
var _this = this;
var aaa = 0;
var pt = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME, function () {
var dt = Date.now() - pt;
aaa += dt;
_this.anchorX = _this.width;
_this.anchorY = _this.height;
if (aaa > 90 && aaa <= 100) {
_this.scaleY = 0.99;
_this.scaleX = 1.01;
}
if (aaa > 190 && aaa < 200) {
_this.scaleX = 1;
_this.scaleY = 1;
aaa = 0;
}
pt = Date.now();
});
};
return Human;
}(engine.Container));
//# sourceMappingURL=Human.js.map
......@@ -163,6 +189,9 @@
_this.R = 250;
_this.D = 340;
_this.con = new engine.Sprite();
_this.t1 = new engine.Sprite(getTexture('a163b74f-32bc-43d2-8015-7cf1eac71501'));
_this.t2 = new engine.Sprite(getTexture('22de82d1-97ec-4195-a32c-f4fc1656e2de'));
_this.t3 = new engine.Sprite(getTexture('cc952365-a990-4912-98af-50905559b9d5'));
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
......@@ -196,6 +225,11 @@
var middleX = this.humanbeing.x + this.humanbeing.width / 2;
var validX1 = this.humanbeing.x;
var validX2 = this.humanbeing.x + this.humanbeing.width;
var drip = new engine.Sprite(getTexture("07f74bf6-416f-445e-98d5-021efe4c9fdc"));
drip.x = 200;
drip.y = 0;
this.dripArray.push(drip);
this.addChild(drip);
for (var i = 0; i < 1000; i++) {
var y = -Math.sqrt(this.R * this.R - (i - middleX - 50) * (i - middleX - 50)) +
(this.humanbeing.y + 180);
......@@ -210,6 +244,7 @@
var point1 = new engine.Graphics();
point1.beginFill(0xff0000);
point1.drawRect(0, 0, 10, 10);
point1.x = 0;
point1.y = 100;
point1.endFill();
this.rightHand.addChild(point1);
......@@ -217,6 +252,7 @@
point2.beginFill(0xff0000);
point2.drawRect(0, 0, 10, 10);
point2.x = 170;
point2.y = 0;
point2.endFill();
this.rightHand.addChild(point2);
var point3 = new engine.Graphics();
......@@ -231,25 +267,25 @@
var ld = Date.now();
var a = 0;
var b = 0;
var drip = new engine.Sprite(getTexture("07f74bf6-416f-445e-98d5-021efe4c9fdc"));
drip.x =
Math.random() * (this.humanbeing.x + 160) +
(this.humanbeing.x - 160);
drip.worldMatrix.ty = Math.random() * 100 + 300;
this.dripArray.push(drip);
this.addChild(drip);
this.winds = createSvga("wind");
this.addChild(this.winds);
this.winds.visible = true;
this.winds.play(true, true);
this.winds.once(engine.Event.END_FRAME, function () {
_this.removeChild(_this.winds);
}, this);
this.addEventListener(engine.Event.ENTER_FRAME, function () {
var dt = Date.now() - ld;
a += dt;
b += dt;
if (a > 200) {
a = 0;
if (_this.timeCounter.time > 0) {
if (_this.moists.percent < 1 && _this.timeCounter.time > 0) {
var drip_1 = new engine.Sprite(getTexture("07f74bf6-416f-445e-98d5-021efe4c9fdc"));
drip_1.x =
Math.random() * (_this.humanbeing.x + 160) +
(_this.humanbeing.x - 160);
drip_1.worldMatrix.ty = Math.random() * 100 + 300;
drip_1.y = Math.random() * 100 + 300;
_this.dripArray.push(drip_1);
_this.addChild(drip_1);
}
......@@ -268,12 +304,12 @@
}
if (b >= 1000) {
b = 0;
_this.timeCounter.time -= 1;
if (_this.timeCounter.time <= 0) {
_this.timeCounter.time = 0;
if (_this.moists.percent < 1) {
_this.timeCounter.time -= 1;
_this.timeCounter.updateTime(_this.timeCounter.time);
}
_this.timeCounter.updateTime(_this.timeCounter.time);
if (_this.timeCounter.time <= 0) {
_this.timeCounter.time = 0;
console.log("游戏成功!");
_this.success();
}
......@@ -289,7 +325,6 @@
ld = Date.now();
_this.angle = Math.asin(_this.D / 2 / _this.R) * 57.18;
_this.rightHand.name = "aaa";
if (_this.stage.height > 1334) ;
var k12 = (point1.worldMatrix.ty - point2.worldMatrix.ty) /
(point1.worldMatrix.tx - point2.worldMatrix.tx);
var k23 = (point2.worldMatrix.ty - point3.worldMatrix.ty) /
......@@ -306,16 +341,16 @@
point2.worldMatrix.tx * k23 - 50;
var y12 = k12 * drip_3.x + b12;
var y23 = k23 * drip_3.x + b23;
if (drip_3.x > minX && drip_3.x < maxX) {
if (drip_3.x >= minX && drip_3.x < maxX) {
if (drip_3.x < px2) {
if (drip_3.worldMatrix.ty >= y12) {
if (drip_3.y >= y12) {
var index_2 = _this.dripArray.indexOf(drip_3);
_this.removeChild(drip_3);
_this.dripArray = _this.dripArray.filter(function (ele, i) { return i != index_2; });
}
}
if (drip_3.x >= px2) {
if (drip_3.worldMatrix.ty >= y23) {
if (drip_3.y >= y23) {
var index_3 = _this.dripArray.indexOf(drip_3);
_this.removeChild(drip_3);
_this.dripArray = _this.dripArray.filter(function (ele, i) { return i != index_3; });
......@@ -339,10 +374,11 @@
face_1.y = 22;
setTimeout(function () {
_this.humanbeing.removeFace(face_1);
}, 1000);
}, 500);
console.log("人");
var index_4 = _this.dripArray.indexOf(drip_3);
_this.dripArray = _this.dripArray.filter(function (ele, i) { return i != index_4; });
_this.humanbeing.scaleEffect();
}
}
};
......
......@@ -2,16 +2,7 @@
"name": "拼图",
"desc": "拼图模块1.0",
"props": {
"MAX_COL": {
"alias": "图片分成几列",
"type": "number",
"default": 3
},
"MAX_ROW": {
"alias": "图片分成几行",
"type": "number",
"default": 4
},
"OFFSET_X": {
"alias": "OFFSET_X",
"type": "number",
......@@ -27,8 +18,8 @@
"type": "number",
"default": 30
},
"GAP": {
"alias": "图片间隙",
"moistPercent": {
"alias": "湿润度",
"type": "number",
"default": 0
}
......@@ -52,6 +43,12 @@
"uuid":"ed0e8931-2557-4527-bcfc-9071f90d5737",
"ext":".png"
},
{
"name":"wind",
"url":"//yun.duiba.com.cn/aurora/assets/15fc1dabf22baedd8bf5e5b418e57cfc81686072.svga",
"uuid":"7f1ef018-79ab-42bf-ac85-0208e36e2928",
"ext":".svga"
},
{
"name":"背景",
"url":"//yun.duiba.com.cn/aurora/assets/d0e22ae58b6e8519b969ed207197a31820790349.png",
......@@ -64,6 +61,24 @@
"uuid":"b7d2a60a-9e60-4eca-be80-a991abea47c9",
"ext":".png"
},
{
"name":"t1",
"url":"//yun.duiba.com.cn/aurora/assets/6cc52715ce3bee15d10acbe90eac5828c21fdc7f.png",
"uuid":"a163b74f-32bc-43d2-8015-7cf1eac71501",
"ext":".png"
},
{
"name":"t2",
"url":"//yun.duiba.com.cn/aurora/assets/0d00d8639caf5d344028b01a1022762724164c92.png",
"uuid":"22de82d1-97ec-4195-a32c-f4fc1656e2de",
"ext":".png"
},
{
"name":"t3",
"url":"//yun.duiba.com.cn/aurora/assets/4b7c2f0d4c8248425ed335838ab5a5ce44256b90.png",
"uuid":"cc952365-a990-4912-98af-50905559b9d5",
"ext":".png"
},
{
"name":"云1",
"url":"//yun.duiba.com.cn/aurora/assets/429981638472e8f02ce2a780f3b05be72d13b943.png",
......
......@@ -185,7 +185,7 @@ export default class GameView extends engine.Container {
ld = Date.now();
return;
// return;
// 扇形的角度
this.angle = Math.asin(this.D / 2 / this.R) * 57.18;
......
......@@ -27,4 +27,27 @@ export default class Human extends engine.Container{
removeFace(face){
this.human.removeChild(face);
}
scaleEffect(){
let aaa = 0;
let pt = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME,()=>{
let dt = Date.now() -pt;
aaa += dt;
this.anchorX = this.width
this.anchorY = this.height;
if(aaa > 90 && aaa<=100 ){
this.scaleY = 0.99;
this.scaleX = 1.01;
}
if(aaa >190 && aaa < 200){
this.scaleX = 1;
this.scaleY = 1;
aaa = 0;
}
pt = Date.now();
})
}
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ export default class TimeCounter extends engine.Container{
timeCounter:engine.Sprite = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));
timeText:any;
time:number
constructor(){
super()
this.time = 20
......@@ -19,6 +21,7 @@ export default class TimeCounter extends engine.Container{
this.timeCounter.addChild(this.timeText);
this.timeText.x = 100;
this.timeText.y = 15;
}
updateTime(time){
......
......@@ -19,6 +19,8 @@ export function createSvga(name, anchorName?) {
return inst;
}
export function getIndexFromRC(row,col,maxCol){
let index;
index = row * maxCol + col ;
......
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