Commit b9273da3 authored by yu's avatar yu

11.2调整

parent 2354ccff
...@@ -23,7 +23,7 @@ export default class Clund_06 extends cc.Component { ...@@ -23,7 +23,7 @@ export default class Clund_06 extends cc.Component {
}); });
pg.event.on("stop_shoot", () => { pg.event.on("stop_shoot", () => {
this.node.x = 0; this.node.x = 0;
this.node.y = -542; // this.node.y = -542;
this.node.angle = 0; this.node.angle = 0;
this.runShoot = false; this.runShoot = false;
}) })
...@@ -34,7 +34,7 @@ export default class Clund_06 extends cc.Component { ...@@ -34,7 +34,7 @@ export default class Clund_06 extends cc.Component {
protected update(dt) { protected update(dt) {
if (!this.runShoot) return; if (!this.runShoot) return;
//子弹位移 //子弹位移
let speed = 10; let speed = 25;
let nextPos = this.angleAndDistance2Point(this.jAngle, speed); let nextPos = this.angleAndDistance2Point(this.jAngle, speed);
this.node.x += nextPos.x; this.node.x += nextPos.x;
this.node.y += nextPos.y; this.node.y += nextPos.y;
......
This diff is collapsed.
...@@ -64,6 +64,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -64,6 +64,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
onLoadEnd() { onLoadEnd() {
cc.macro.ENABLE_MULTI_TOUCH = false;//禁用多指操作
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考 // TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData(); this.initData();
this.initView(); this.initView();
...@@ -118,7 +119,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -118,7 +119,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
let btn_next = cc.find("layout_finish/btn_next", this.node); let btn_next = cc.find("layout_finish/btn_next", this.node);
btn_again.on(cc.Node.EventType.TOUCH_END, this.onAgain, this); btn_again.on(cc.Node.EventType.TOUCH_END, this.onAgain, this);
btn_next.on(cc.Node.EventType.TOUCH_END, this.onNext, this); btn_next.on(cc.Node.EventType.TOUCH_END, this.onNext, this);
cc.find("btn_touch", this.layout_game).on(cc.Node.EventType.TOUCH_END, this.onLayoutTouch, this); let btn_touch = cc.find("btn_touch", this.layout_game);
btn_touch.on(cc.Node.EventType.TOUCH_END, this.onLayoutTouch, this);
btn_touch.on(cc.Node.EventType.TOUCH_START, this.onLayoutStart, this);
btn_touch.on(cc.Node.EventType.TOUCH_MOVE, this.onLayoutMove, this);
cc.find("gong_touch", this.layout_game).on(cc.Node.EventType.TOUCH_END, this.onGongBullet, this);
pg.event.on("game_start", () => { pg.event.on("game_start", () => {
this.gameStart(); this.gameStart();
}); });
...@@ -132,7 +137,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -132,7 +137,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
// } // }
}); });
pg.event.on("bullet_reset_pos", () => { pg.event.on("bullet_reset_pos", () => {
const gameCanvas = cc.view.getVisibleSize();
let gameWidthX = gameCanvas.width;
let gameHeightX = gameCanvas.height
this.touching = false; this.touching = false;
this.gong_item.angle = 0;
this.jian_item.y = -gameHeightX / 2 - 30;
}); });
} }
private resetGame() { private resetGame() {
...@@ -155,15 +165,32 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -155,15 +165,32 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
} }
private onLayoutTouch(e) { private onLayoutTouch(e) {
if (this.touching) return; this.gongAngle(e)
this.touching = true; }
private onLayoutStart(e) {
this.gongAngle(e)
}
private onLayoutMove(e) {
this.gongAngle(e)
}
private gongAngle(e) {
this.jian_item.angle = 0; this.jian_item.angle = 0;
let point = e.touch.getLocation(); let point = e.touch.getLocation();
let jp = cc.v2(point.x - this.layout_balloon.width / 2, point.y - this.layout_balloon.height / 2); let jp = cc.v2(point.x - this.layout_balloon.width / 2, point.y - this.layout_balloon.height / 2);
let lefP = cc.v2(0, -542); let lefP = cc.v2(0, -542);
let angle = this.getDegree(lefP, jp); let angle = this.getDegree(lefP, jp);
// this.jian_item.angle = angle; if (angle > 80) angle = 80;
if (angle < -80) angle = -80;
this.gong_item.angle = angle;
this.jian_item.angle = angle;
}
private onGongBullet() {
if (this.touching) return;
this.touching = true;
let angle = this.jian_item.angle;
this.playLocalAudio("gShow");
pg.event.emit("bullet_shoot", angle); pg.event.emit("bullet_shoot", angle);
} }
private gameOver() { private gameOver() {
...@@ -185,7 +212,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -185,7 +212,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.lastCount = null; this.lastCount = null;
this.touchFishs = []; this.touchFishs = [];
this.layout_balloon.removeAllChildren(); this.layout_balloon.removeAllChildren();
this.playLocalAudio("gShow");
this.showEnter().then(() => { this.showEnter().then(() => {
this.showQuestion(); this.showQuestion();
}); });
...@@ -203,9 +229,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -203,9 +229,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.gong_item.y = -900; this.gong_item.y = -900;
this.jian_item.y = -900; this.jian_item.y = -900;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
cc.tween(this.gong_item).to(0.5, { y: -gameHeightX / 2 + 30 }) cc.tween(this.gong_item).to(0.5, { y: -gameHeightX / 2 - 30 })
.call(() => { .call(() => {
cc.tween(this.jian_item).to(0.5, { y: -gameHeightX / 2 }).start(); cc.tween(this.jian_item).to(0.5, { y: -gameHeightX / 2 - 30 }).start();
pg.audio.playAudioByUrl(question.audio); pg.audio.playAudioByUrl(question.audio);
cc.tween(this.gong_word).to(0.3, { opacity: 255, scale: 1 }) cc.tween(this.gong_word).to(0.3, { opacity: 255, scale: 1 })
.call(() => { .call(() => {
...@@ -279,7 +305,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -279,7 +305,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
update(dt) { update(dt) {
if (Game.getIns().state != GAME_STATE.RUNNING) return; if (Game.getIns().state != GAME_STATE.RUNNING) return;
// if (this.touching) return; // if (this.touching) return;
if (this.fishLen < 5) this.count++; if (this.fishLen < 6) this.count++;
let fish = this.getFishByCount(this.count); let fish = this.getFishByCount(this.count);
if (fish) this.fishs.push(fish); if (fish) this.fishs.push(fish);
this.isHitBalloon(); this.isHitBalloon();
...@@ -288,8 +314,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -288,8 +314,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (!this.touching) return; if (!this.touching) return;
this.fishs.forEach((item) => { this.fishs.forEach((item) => {
let dis = this.getDistances(this.jian_item, item); let dis = this.getDistances(this.jian_item, item);
if (dis < 150 && item.data.fish.isOut == FISH_OUT.RUNNING) { if (dis < 160 && item.data.fish.isOut == FISH_OUT.RUNNING) {
if (item.x < 200 && item.x > -200 && item.y < -350) return; if (item.x < 200 && item.x > -200 && item.y < -300) return;
pg.event.emit("stop_shoot"); pg.event.emit("stop_shoot");
cc.Tween.stopAllByTarget(item); cc.Tween.stopAllByTarget(item);
let state = item.data.right ? FISH_STATE.BREAK : FISH_STATE.FALL; let state = item.data.right ? FISH_STATE.BREAK : FISH_STATE.FALL;
...@@ -318,7 +344,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -318,7 +344,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.visible(pg.view.find(item, 'bomb'), true); pg.view.visible(pg.view.find(item, 'bomb'), true);
this.schedule(() => { this.schedule(() => {
item.active = false; item.active = false;
}, 1); }, 0.4);
resolve(''); resolve('');
break; break;
case FISH_STATE.FALL: case FISH_STATE.FALL:
...@@ -341,7 +367,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -341,7 +367,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
updateFish(item, data: Option) { updateFish(item, data: Option) {
// pg.view.touchOn(item, this.onTouchItem, this); // pg.view.touchOn(item, this.onTouchItem, this);
if (!this.fishCount) this.fishCount = 0; if (!this.fishCount) this.fishCount = 0;
let id = this.fishCount % 5 + 1; let id = this.fishCount % 6;
this.fishCount++; this.fishCount++;
// let res = pg.view.find(item, 'res'); // let res = pg.view.find(item, 'res');
...@@ -368,15 +394,16 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -368,15 +394,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
} }
let pos = [-794, -480, -160, 155, 473, 798];
item.parent = this.layout_balloon; item.parent = this.layout_balloon;
item.data = data; item.data = data;
data.fish.node = item; data.fish.node = item;
//x y 起始点 和终点 进行 随机 //x y 起始点 和终点 进行 随机
cc.Tween.stopAllByTarget(item); cc.Tween.stopAllByTarget(item);
//左往右 //左往右
item.x = -1334 / 2 + Math.random() * 1334; item.x = pos[id];//-1334 / 2 + Math.random() * 1334;
item.y = -(720 / 2 + Math.random() * 400);// item.y = -(700 + Math.random() * 400);//
cc.tween(item).to(7 + Math.random() * 6, { y: 1500 }).call(() => { cc.tween(item).to(4 + Math.random() * 5, { y: 1000 }).call(() => {
data.fish.isOut = FISH_OUT.OUT; data.fish.isOut = FISH_OUT.OUT;
this.viewFishs = this.viewFishs.filter(v => v.id != data.id); this.viewFishs = this.viewFishs.filter(v => v.id != data.id);
}).start(); }).start();
...@@ -540,3 +567,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -540,3 +567,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
/**
* NGT06分类气球
1. 发射过程,不是点击气球,而是点击弓,然后释放弓,按角度发射箭;
2. 弓应该是旋转的,我给过示意图;
3. 弓上的字体需要加粗,看效果图;
4. 箭的速度太慢了,看我给的视频例子,这个速度就好;
5. 箭发出应该有音效;
6. 气球爆炸的图片停留的时间太久的,停留0.5秒,一闪而过就好;
7. 气球总是扎堆,需要左右分离一些留一些距离;(不是从左侧扎堆,就是从右侧扎堆)
*/
\ No newline at end of file
...@@ -28,7 +28,7 @@ export class Option { ...@@ -28,7 +28,7 @@ export class Option {
public touchRight: boolean; public touchRight: boolean;
public parent; public parent;
public pairKey; public pairKey;
fish: any; public fish: any;
constructor(data, id) { constructor(data, id) {
this.id = id; this.id = id;
this.type = data.type; this.type = data.type;
......
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