Commit 0912c937 authored by wildfirecode's avatar wildfirecode

1

parent 9bbe9bd6
No preview for this file type
......@@ -45,6 +45,7 @@
var __debug__ = 1;
var __monkeyHandSize__ = 50;
var __boxMoveSpeed__ = 6;
var __boxOpenState__ = 'resource/assets/startScene/openstate.json';
var __boxmap__ = {
coin:{ award: 0, skin: 'resource/assets/startScene/coin.json', offset: [117, 68] },
gift:{ award: 0, skin: 'resource/assets/startScene/gift.json', offset: [119, 103] },
......
......@@ -14,4 +14,5 @@ declare interface IBoxItem {
declare var __boxmap__: { [key: string]: IBoxItem };
declare var __bgUrl__:string;
declare var __monkeyHandSize__:number;
declare var __boxMoveSpeed__:number;
\ No newline at end of file
declare var __boxMoveSpeed__:number;
declare var __boxOpenState__:string;
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"guide_4","version":5,"files":["../assets/startScene/guide/guide_tips.png","../assets/startScene/guide/guide_hand.png","../assets/startScene/guide/guide_dialog.png"]}
\ No newline at end of file
{"file":"openstate.png","frames":{
"silverboxOpenState":{"x":0,"y":0,"w":292,"h":222,"offX":0,"offY":0,"sourceW":292,"sourceH":222},
"woodboxOpenState":{"x":762,"y":0,"w":220,"h":209,"offX":0,"offY":0,"sourceW":220,"sourceH":209},
"coinOpenState":{"x":294,"y":216,"w":148,"h":151,"offX":2,"offY":3,"sourceW":150,"sourceH":154},
"gift2OpenState":{"x":543,"y":0,"w":217,"h":232,"offX":0,"offY":0,"sourceW":217,"sourceH":232},
"goldenboxOpenState":{"x":294,"y":0,"w":247,"h":214,"offX":0,"offY":0,"sourceW":247,"sourceH":214},
"giftOpenState":{"x":762,"y":211,"w":206,"h":218,"offX":0,"offY":0,"sourceW":206,"sourceH":218}}}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import { ExmlPlugin2 } from "./ExmlPlugin2";
export class MyExmlPlugin extends ExmlPlugin2 implements plugins.Command {
async onFile(file: plugins.File) {
const excludes = [
'openstate.png',
'coin.png',
'gift.png',
'gift2.png',
......
......@@ -82,7 +82,7 @@ export default class Box extends egret.Sprite {
});
}
private _vyStart = 15;
private _vyStart = 12;
private _vy: number;
private _gy: number;
private _throwStartVY: number;
......
......@@ -12,7 +12,7 @@ export default class Monkey extends egret.Sprite {
private targetY = 70;
private targetX = 369;
static RANGE = 60;
private _shakeSpeed = 1;
private _shakeSpeed = .5;
constructor() {
super();
this.anchorOffsetX = 113;
......
import { GamePlayModel } from "../../libs/tw/model/game/GamePlayModel";
import Scene from "../views/Scene";
import Box from "./Box";
import BoxListCtrl from "./BoxListCtrl";
import Monkey from "./Monkey";
import Net from "./Net";
import LayerTypes from "./data/LayerTypes";
import debug from "./debug";
import Guide from "./Guide";
import GuideCtrl from "./GuideCtrl";
import Box from "./Box";
import debug from "./debug";
import LayerTypes from "./data/LayerTypes";
import Monkey from "./Monkey";
import Net from "./Net";
import BoxOpenState from "./view/BoxOpenState";
const { TouchEvent } = egret;
export default class StartScene extends Scene {
......@@ -52,6 +53,8 @@ export default class StartScene extends Scene {
this._debug = new debug(this.getLayer(LayerTypes.top));
}
const model = new GamePlayModel();
model.update();
......@@ -82,6 +85,7 @@ export default class StartScene extends Scene {
}
private _catchedBox: Box;
private _cathchedBoxOpenState: BoxOpenState;
doAction() {
this._net.doAction();
const catchedBoxs = this._boxListCtrl.boxs.filter(
......@@ -135,7 +139,19 @@ export default class StartScene extends Scene {
onNotCatchedByMonkey() {
this.removeThrowTick();
this._catchedBox = null;
this._cathchedBoxOpenState = new BoxOpenState(this._catchedBox.type);
this._cathchedBoxOpenState.x = this._catchedBox.x;
this._cathchedBoxOpenState.y = this._catchedBox.y;
this.topLay.addChild(this._cathchedBoxOpenState);
this._cathchedBoxOpenState.onReady = () => {
egret.Tween.get(this._catchedBox).to({ alpha: 0 }, 500);
this._catchedBox = null;
}
this._cathchedBoxOpenState.start();
setTimeout(() => {
this._cathchedBoxOpenState.destroy();
this._cathchedBoxOpenState = null;
},1000);
}
private _handX: number;
......
export default class BoxOpenState extends egret.Bitmap {
_type: string;
onReady: () => void;
constructor(type) {
super();
this._type = type;
}
start(): any {
RES.getResByUrl(__boxOpenState__, (sheet: egret.SpriteSheet) => {
const texture = sheet.getTexture(`${this._type}OpenState`);
this.$setBitmapData(texture);
this.anchorOffsetX = texture.textureWidth >> 1;
this.anchorOffsetY = texture.textureHeight >> 1;
this.scaleX = this.scaleY = 1.5;
egret.Tween.get(this)
.set({ alpha: 0 })
.to({ alpha: 1 }, 200)
.call(() => {
this.onReady();
this.shake();
})
}, this, RES.ResourceItem.TYPE_SHEET);
}
destroy() {
egret.Tween.removeTweens(this);
egret.Tween.get(this).to({alpha:0},500).call(()=>{
this.parent.removeChild(this);
});
}
shake(): any {
const x0 = this.x;
const y0 = this.y;
const offset = 10;
egret.Tween.get(this, { loop: true })
.set({ y: y0 - offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 + offset }).wait(30)
.set({ y: y0 + offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 - offset }).wait(30)
.set({ y: y0 - offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 + offset }).wait(30)
.set({ y: y0 + offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 - offset }).wait(30)
.wait(500);
}
}
\ 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