Commit bea870f5 authored by zjz1994's avatar zjz1994

代码暂存

parent 426cdc81
This diff is collapsed.
...@@ -16,7 +16,7 @@ export class Player extends engine.Container{ ...@@ -16,7 +16,7 @@ export class Player extends engine.Container{
this._container.addChild(this.playerNode); this._container.addChild(this.playerNode);
this.playerNode.y = this.playery; this.playerNode.y = this.playery;
this.playerNode.x = pierWidth/2 - 50; this.playerNode.x = pierWidth/2 - 50;
this.playerNode.play(); this.playerNode.stop();
this._container.visible = false; this._container.visible = false;
} }
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -52,6 +52,12 @@ ...@@ -52,6 +52,12 @@
"url": "//yun.duiba.com.cn/aurora/assets/a3ce52a41ed53ccfa7ce404dbc10102961c4a805.png", "url": "//yun.duiba.com.cn/aurora/assets/a3ce52a41ed53ccfa7ce404dbc10102961c4a805.png",
"uuid": "selected", "uuid": "selected",
"ext": ".png" "ext": ".png"
},
{
"name": "房子动画",
"url": "//yun.duiba.com.cn/aurora/assets/f55c640d40911934c7c5cf01f4fc1940ffb4e16c.svga",
"uuid": "homeani",
"ext": ".svga"
} }
], ],
"events": { "events": {
......
This diff is collapsed.
...@@ -26,6 +26,8 @@ export default class MapData{ ...@@ -26,6 +26,8 @@ export default class MapData{
}; };
static eleidx = 1; static eleidx = 1;
static elePool = []; static elePool = [];
static anispeed = 860;
static getRy(r){ static getRy(r){
return this.paddingb+r*(this.itemsize+this.paddingi); return this.paddingb+r*(this.itemsize+this.paddingi);
} }
......
...@@ -16,6 +16,10 @@ export default class Element extends engine.Container{ ...@@ -16,6 +16,10 @@ export default class Element extends engine.Container{
this.width = MapData.itemsize; this.width = MapData.itemsize;
this.height = MapData.itemsize; this.height = MapData.itemsize;
this.anchorX = MapData.itemsize/2;
// this.anchorY = MapData.itemsize/2;
this.anchorY = MapData.itemsize;
this.eimage = new engine.Image(); this.eimage = new engine.Image();
this.addChild(this.eimage); this.addChild(this.eimage);
this.touch = true; this.touch = true;
...@@ -55,7 +59,7 @@ export default class Element extends engine.Container{ ...@@ -55,7 +59,7 @@ export default class Element extends engine.Container{
this.x = (1 - value) * (1 - value) * this.p1x + 2 * value * (1 - value) * this.c1x + value * value * this.p2x; this.x = (1 - value) * (1 - value) * this.p1x + 2 * value * (1 - value) * this.c1x + value * value * this.p2x;
this.y = (1 - value) * (1 - value) * this.p1y + 2 * value * (1 - value) * this.c1y + value * value * this.p2y; this.y = (1 - value) * (1 - value) * this.p1y + 2 * value * (1 - value) * this.c1y + value * value * this.p2y;
var mscale = (1 - value) * (1 - value) * 1 + 2 * value * (1 - value) * 0.6 + value * value * 0; var mscale = (1 - value) * (1 - value) * 1 + 2 * value * (1 - value) * 0.6 + value * value * 0.35;
this.scaleX = mscale; this.scaleX = mscale;
this.scaleY = mscale; this.scaleY = mscale;
} }
...@@ -70,7 +74,7 @@ export default class Element extends engine.Container{ ...@@ -70,7 +74,7 @@ export default class Element extends engine.Container{
//飞到小屋 //飞到小屋
flyToHome(tx,ty,time){ flyToHome(tx,ty,time){
this.p1x = this.x; this.p1x = this.x;
this.p1y = this.y; this.p1y = this.y+20;
this.c1x = (this.p1x-tx)/4+tx; this.c1x = (this.p1x-tx)/4+tx;
this.c1y = ty; this.c1y = ty;
...@@ -78,17 +82,52 @@ export default class Element extends engine.Container{ ...@@ -78,17 +82,52 @@ export default class Element extends engine.Container{
this.p2x = tx; this.p2x = tx;
this.p2y = ty; this.p2y = ty;
engine.Tween.get(this).to({
scaleX:1.1,
scaleY:1.1
},200)
.to({
scaleX:1.1,
scaleY:0.88
},100)
.to({
scaleX:0.98,
scaleY:0.98,
y:this.y+20
},100)
.call(()=>{
engine.Tween.get(this).to({ engine.Tween.get(this).to({
factor:1 factor:1
},time) },450)
.call(()=>{ .call(()=>{
let nodeparent:engine.Container = this.parent; let nodeparent:engine.Container = this.parent;
nodeparent&&nodeparent.removeChild(this); nodeparent&&nodeparent.removeChild(this);
MapData.recoverEle(this); MapData.recoverEle(this);
}) })
})
} }
changePos(){ changePos(tpos:Array<number>){
let nx = this.x;
let ny = this.y;
let tx = tpos[0];
let ty = tpos[1];
let dis = MapData.getDistance([nx,ny],tpos);
let time = Math.ceil(dis/MapData.anispeed*1000);
let pro = new Promise(res=>{
engine.Tween.get(this,{loop:false}).to({
x:tx,
y:ty
},time)
.call(()=>{
console.log("单个移动完毕");
res();
})
})
return pro;
} }
} }
\ No newline at end of file
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