Commit 13ca26c8 authored by Chen Jiping's avatar Chen Jiping

完善

parent bbb4c9be
...@@ -720,7 +720,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -720,7 +720,7 @@ export class PlayComponent implements OnInit, OnDestroy {
bg_pic.init(this.images.get("bg")); bg_pic.init(this.images.get("bg"));
bg_pic.x = this.canvasWidth / 2; bg_pic.x = this.canvasWidth / 2;
bg_pic.y = this.canvasHeight / 2; bg_pic.y = this.canvasHeight / 2;
bg_pic.setScaleXY(this.canvasWidth / bg_pic.width); bg_pic.setScaleXY(Math.max(this.canvasWidth / bg_pic.width, this.canvasHeight / bg_pic.height));
bg_pic.childDepandAlpha = false; bg_pic.childDepandAlpha = false;
this.bgRenderArr.push(bg_pic); this.bgRenderArr.push(bg_pic);
...@@ -920,7 +920,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -920,7 +920,7 @@ export class PlayComponent implements OnInit, OnDestroy {
//青蛙初始位置 //青蛙初始位置
this.frog.initX = this.canvasWidth + frogWidth; this.frog.initX = this.canvasWidth + frogWidth;
this.frog.initY = this.canvasHeight + frogHeight; this.frog.initY = this.canvasHeight;
this.frog.width = frogWidth; this.frog.width = frogWidth;
this.frog.height = frogHeight; this.frog.height = frogHeight;
...@@ -1080,12 +1080,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1080,12 +1080,12 @@ export class PlayComponent implements OnInit, OnDestroy {
let d = Math.sqrt( w * w + h * h); let d = Math.sqrt( w * w + h * h);
content_pic.setScaleXY((parItem.getBoundingBox().height - 50 * this.mapScale) / d); content_pic.setScaleXY((parItem.height - 22 * this.mapScale) / d);
content_pic.alpha = 0; content_pic.alpha = 0;
content_pic.x = 0; content_pic.x = 0;
content_pic.y = -20 * this.mapScale; content_pic.y = -10 * this.mapScale;
parItem.addChild(content_pic); parItem.addChild(content_pic);
parItem2.addChild(content_pic); parItem2.addChild(content_pic);
...@@ -1095,14 +1095,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1095,14 +1095,14 @@ export class PlayComponent implements OnInit, OnDestroy {
let content_val = new Label(); let content_val = new Label();
content_val.text = content.val; content_val.text = content.val;
content_val.textAlign='middle'; content_val.textAlign='middle';
content_val.fontSize = 50; content_val.fontSize = 120;
content_val.fontName = "BRLNSDB"; content_val.fontName = "BRLNSDB";
content_val.fontColor = "#006400"; content_val.fontColor = "#006400";
content_val.alpha = 0; content_val.alpha = 0;
content_val.refreshSize(); content_val.refreshSize();
setFontSize(parItem.getBoundingBox().height - 70 * this.mapScale, content_val); setFontSize(parItem.height - 40 * this.mapScale, content_val);
content_val.refreshSize(); content_val.refreshSize();
...@@ -1544,7 +1544,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1544,7 +1544,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.frog.bigLeafY = toY; this.frog.bigLeafY = toY;
//跳到大荷叶上 //跳到大荷叶上
this.frogJump(toX, toY, 1, ()=>{ this.frogJump(toX, toY, 0.5, ()=>{
this.playAudio('croak'); this.playAudio('croak');
...@@ -1553,6 +1553,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1553,6 +1553,8 @@ export class PlayComponent implements OnInit, OnDestroy {
//播放青蛙待机动画 //播放青蛙待机动画
this.animation(this.frog, this.frog.standbys, 0, 80); this.animation(this.frog, this.frog.standbys, 0, 80);
}); });
} }
/** /**
...@@ -1701,6 +1703,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1701,6 +1703,14 @@ export class PlayComponent implements OnInit, OnDestroy {
//停止动画 //停止动画
this.frog.animationStop = true; this.frog.animationStop = true;
let sX = this.frog.bg.x;
let sY = this.frog.bg.y;
//计算中间坐标
let mPos = this.getJumpMiddleMap(toX, toY, sX, sY);
tweenChange(this.frog.bg, {x : mPos.x, y : mPos.y}, time/2, ()=>{
tweenChange(this.frog.bg, {x : toX, y : toY}, time, ()=>{ tweenChange(this.frog.bg, {x : toX, y : toY}, time, ()=>{
this.frog.jumpedUp.visible = false; this.frog.jumpedUp.visible = false;
...@@ -1716,6 +1726,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1716,6 +1726,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}); });
});
} }
...@@ -1819,8 +1831,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1819,8 +1831,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.playEnd = true; this.playEnd = true;
this.canTouch = false;
this.playAudio('handclap', false, () => { this.playAudio('handclap', false, () => {
//撒花结束 //撒花结束
...@@ -1828,8 +1838,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1828,8 +1838,12 @@ export class PlayComponent implements OnInit, OnDestroy {
//等待所有花瓣落下后才能点击 //等待所有花瓣落下后才能点击
setTimeout(() => { setTimeout(() => {
this.canTouch = true; //显示重新开始按钮
}, 2000); tweenChange(this.btnRestart.sprite, {x: this.btnRestart.showX, y:this.btnRestart.showY}, 0.3);
this.tempSmallLotusLeafs = [... this.smallLotusLeafs];
}, 4000);
}); });
...@@ -1843,11 +1857,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1843,11 +1857,9 @@ export class PlayComponent implements OnInit, OnDestroy {
//大荷叶划出屏幕 //大荷叶划出屏幕
let toX = this.canvasWidth + this.bigLotusLeaf.lotusLeaf.getBoundingBox().width / 2; let toX = this.canvasWidth + this.bigLotusLeaf.lotusLeaf.getBoundingBox().width / 2;
let toY = this.canvasHeight + this.bigLotusLeaf.lotusLeaf.getBoundingBox().height / 2; let toY = this.canvasHeight + this.bigLotusLeaf.lotusLeaf.getBoundingBox().height / 2;
tweenChange(this.bigLotusLeaf.lotusLeaf, {x: toX, y:toY}, 0.5, ()=>{ tweenChange(this.bigLotusLeaf.lotusLeaf, {x: toX, y:toY}, 0.5, ()=>{
//显示重新开始按钮
tweenChange(this.btnRestart.sprite, {x: this.btnRestart.showX, y:this.btnRestart.showY}, 0.3);
this.tempSmallLotusLeafs = [... this.smallLotusLeafs];
}); });
} }
...@@ -1906,4 +1918,30 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1906,4 +1918,30 @@ export class PlayComponent implements OnInit, OnDestroy {
this.playGame(); this.playGame();
} }
/**
* 获取青蛙跳入指定位置的中间坐标
* @param toX
* @param toY
* @param sX
* @param sY
*/
getJumpMiddleMap(toX, toY, sX, sY){
//斜率
let k = (toY - sY)/(toX - sX);
//取得跳出的坐标
let mX = (sX + toX) / 2;
let mY = k * (mX - toX) + toY;
//如果目的地x坐标比原来坐标小,则增加中间高度
if(sX > toX + 50 * this.mapScale){
mY = mY - 180 * this.mapScale;
}
return {x : mX, y: mY};
}
} }
src/assets/play/petal_11.png

1.11 KB | W: | H:

src/assets/play/petal_11.png

835 Bytes | W: | H:

src/assets/play/petal_11.png
src/assets/play/petal_11.png
src/assets/play/petal_11.png
src/assets/play/petal_11.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/petal_12.png

665 Bytes | W: | H:

src/assets/play/petal_12.png

835 Bytes | W: | H:

src/assets/play/petal_12.png
src/assets/play/petal_12.png
src/assets/play/petal_12.png
src/assets/play/petal_12.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/petal_14.png

852 Bytes | W: | H:

src/assets/play/petal_14.png

1014 Bytes | W: | H:

src/assets/play/petal_14.png
src/assets/play/petal_14.png
src/assets/play/petal_14.png
src/assets/play/petal_14.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/petal_3.png

835 Bytes | W: | H:

src/assets/play/petal_3.png

1.11 KB | W: | H:

src/assets/play/petal_3.png
src/assets/play/petal_3.png
src/assets/play/petal_3.png
src/assets/play/petal_3.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/petal_7.png

835 Bytes | W: | H:

src/assets/play/petal_7.png

665 Bytes | W: | H:

src/assets/play/petal_7.png
src/assets/play/petal_7.png
src/assets/play/petal_7.png
src/assets/play/petal_7.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/petal_9.png

1014 Bytes | W: | H:

src/assets/play/petal_9.png

852 Bytes | W: | H:

src/assets/play/petal_9.png
src/assets/play/petal_9.png
src/assets/play/petal_9.png
src/assets/play/petal_9.png
  • 2-up
  • Swipe
  • Onion skin
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