window.__require = function e(t, n, r) {
  function s(o, u) {
    if (!n[o]) {
      if (!t[o]) {
        var b = o.split("/");
        b = b[b.length - 1];
        if (!t[b]) {
          var a = "function" == typeof __require && __require;
          if (!u && a) return a(b, !0);
          if (i) return i(b, !0);
          throw new Error("Cannot find module '" + o + "'");
        }
      }
      var f = n[o] = {
        exports: {}
      };
      t[o][0].call(f.exports, function(e) {
        var n = t[o][1][e];
        return s(n || e);
      }, f, f.exports, e, t, n, r);
    }
    return n[o].exports;
  }
  var i = "function" == typeof __require && __require;
  for (var o = 0; o < r.length; o++) s(r[o]);
  return s;
}({
  Helloworld: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "e1b90/rohdEk4SdmmEZANaD", "Helloworld");
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
    function addTouchEvent(com) {
      com.node.on(cc.Node.EventType.TOUCH_START, com.onTouchStart, com);
      com.node.on(cc.Node.EventType.TOUCH_MOVE, com.onTouchMove, com);
      com.node.on(cc.Node.EventType.TOUCH_END, com.onTouchEnd, com);
      com.node.on(cc.Node.EventType.TOUCH_CANCEL, com.onTouchEnd, com);
    }
    exports.addTouchEvent = addTouchEvent;
    var Helloworld = function(_super) {
      __extends(Helloworld, _super);
      function Helloworld() {
        var _this = null !== _super && _super.apply(this, arguments) || this;
        _this.label = null;
        _this.text = "hello";
        _this.bulletPf = null;
        _this.isPress = false;
        _this.playerVel = 0;
        _this.showCnt = 0;
        return _this;
      }
      Helloworld.prototype.onLoad = function() {
        cc.director.getPhysicsManager().gravity = cc.v2(0, 0);
        cc.director.getPhysicsManager().enabled = true;
        this.velStr = cc.find("Vel").getComponent(cc.Label);
      };
      Helloworld.prototype.start = function() {
        this.moveVector = cc.v2();
        this.label.string = this.text;
        this.player = cc.find("World/Player");
        cc.game.setFrameRate(30);
        addTouchEvent(this);
      };
      Helloworld.prototype.update = function(dt) {
        var rigidBody = this.player.getComponent(cc.RigidBody);
        if (0 == this.moveVector.x) rigidBody.linearVelocity = cc.v2(); else {
          var addV = 500;
          cc.sys.platform == cc.sys.WECHAT_GAME && (addV = 2e3);
          rigidBody.applyLinearImpulse(this.moveVector.mul(addV), this.player.position, true);
          var curSpeed = rigidBody.linearVelocity;
          var curVelocity = curSpeed.mag();
          var limit = 500;
          cc.sys.platform == cc.sys.WECHAT_GAME && (limit = 1e3);
          if (curVelocity > limit) {
            var newvec = curSpeed.normalize().mul(limit);
            rigidBody.linearVelocity = newvec;
          }
        }
      };
      Helloworld.prototype.lateUpdate = function(dt) {
        this.lastPos || (this.lastPos = this.player.getPosition());
        this.showCnt += dt;
        if (this.showCnt > .5) {
          this.velStr.string = String(Math.round(this.player.position.sub(this.lastPos).mag() / dt));
          this.showCnt = 0;
        }
        this.lastPos = this.player.getPosition();
      };
      Helloworld.prototype.onTouchStart = function(eve) {
        this.isPress = true;
        var n = eve.getLocation();
        n.x > 480 ? this.moveVector = cc.v2(1, 0) : this.moveVector = cc.v2(-1, 0);
      };
      Helloworld.prototype.onTouchMove = function(eve) {};
      Helloworld.prototype.onTouchEnd = function(eve) {
        this.isPress = false;
        this.moveVector = cc.v2();
      };
      __decorate([ property(cc.Label) ], Helloworld.prototype, "label", void 0);
      __decorate([ property ], Helloworld.prototype, "text", void 0);
      __decorate([ property(cc.Prefab) ], Helloworld.prototype, "bulletPf", void 0);
      Helloworld = __decorate([ ccclass ], Helloworld);
      return Helloworld;
    }(cc.Component);
    exports.default = Helloworld;
    cc._RF.pop();
  }, {} ],
  SimpleBulletView: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "c7740GnumdE+7dwFSqErqYQ", "SimpleBulletView");
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property, disallowMultiple = _a.disallowMultiple, menu = _a.menu;
    function pSetInLength(v, len) {
      v.normalizeSelf();
      v.mulSelf(len);
    }
    exports.pSetInLength = pSetInLength;
    var SimpleBulletView = function(_super) {
      __extends(SimpleBulletView, _super);
      function SimpleBulletView() {
        var _this = null !== _super && _super.apply(this, arguments) || this;
        _this.id = 0;
        _this.acc = 0;
        _this.isDying = false;
        _this._dyingCnt = 0;
        _this.inited = false;
        _this.isFirstUpdate = false;
        return _this;
      }
      SimpleBulletView.prototype.start = function() {};
      SimpleBulletView.prototype.reuse = function(id, pos, endPos, curVel, acc) {
        this.endPos = endPos;
        this.isDying = false;
        this._dyingCnt = 0;
        this.id = id;
        this.node.setPosition(pos);
        var dir = endPos.sub(pos);
        pSetInLength(dir, curVel);
        this.speed = dir;
        this.acc = acc;
        this.inited = true;
        this.isFirstUpdate = true;
      };
      SimpleBulletView.prototype.unuse = function() {};
      SimpleBulletView.prototype.lateUpdate = function(dt) {
        if (!this.inited) return;
        if (this.isFirstUpdate) {
          this.isFirstUpdate = false;
          return;
        }
        var speedLen;
        if (this.isDying) return;
        speedLen = this.speed.mag();
        speedLen += this.acc * dt;
        pSetInLength(this.speed, speedLen);
        this.node.x += this.speed.x * dt;
        this.node.y += this.speed.y * dt;
        if (this.endPos) {
          var isXOver = false;
          var isYOver = false;
          isXOver = this.speed.x > 0 ? this.node.x >= this.endPos.x : this.node.x <= this.endPos.x;
          isYOver = this.speed.y > 0 ? this.node.y >= this.endPos.y : this.node.y <= this.endPos.y;
          isXOver && isYOver && this.die(this.endPos);
        }
      };
      SimpleBulletView.prototype.die = function(pos) {
        var _this = this;
        if (this.isDying) return;
        this.isDying = true;
        pos && this.node.setPosition(pos);
        this.getComponent(cc.MotionStreak).reset();
        var disappearTime = .2;
        this.node.runAction(cc.sequence(cc.delayTime(disappearTime), cc.callFunc(function() {
          _this.node.destroy();
          _this.inited = false;
        })));
      };
      SimpleBulletView = __decorate([ ccclass, disallowMultiple, menu("View/SimpleBulletView") ], SimpleBulletView);
      return SimpleBulletView;
    }(cc.Component);
    exports.SimpleBulletView = SimpleBulletView;
    cc._RF.pop();
  }, {} ],
  Test: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "bbe4egwTZNGRpoSDSYm1UnX", "Test");
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
    var NewClass = function(_super) {
      __extends(NewClass, _super);
      function NewClass() {
        var _this = null !== _super && _super.apply(this, arguments) || this;
        _this.label = null;
        _this.pf = null;
        _this.text = "hello";
        return _this;
      }
      NewClass.prototype.onLoad = function() {
        this.scheduleOnce(this.setSprite, 1);
      };
      NewClass.prototype.setSprite = function() {
        var node = cc.instantiate(this.pf);
        this.node.addChild(node);
        node.setPosition(cc.v2());
      };
      NewClass.prototype.start = function() {};
      __decorate([ property(cc.Label) ], NewClass.prototype, "label", void 0);
      __decorate([ property(cc.Prefab) ], NewClass.prototype, "pf", void 0);
      __decorate([ property ], NewClass.prototype, "text", void 0);
      NewClass = __decorate([ ccclass ], NewClass);
      return NewClass;
    }(cc.Component);
    exports.default = NewClass;
    cc._RF.pop();
  }, {} ]
}, {}, [ "Helloworld", "SimpleBulletView", "Test" ]);