(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/play.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '6657etUdNpHvYB1+25GPrPV', 'play', __filename);
// play.js

'use strict';

// Learn cc.Class:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {
        ydsd: 200,
        ydx: 0,
        ydy: 0
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start: function start() {
        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
    },

    onKeyDown: function onKeyDown(event) {
        switch (event.keyCode) {
            case cc.macro.KEY.up:
            case cc.macro.KEY.dpadUp:
                this.ydy = 1;
                console.log('66666');

                break;
            case cc.macro.KEY.down:
            case cc.macro.KEY.dpadDown:
                this.ydy = -1;
                break;
            case cc.macro.KEY.left:
            case cc.macro.KEY.dpadLeft:
                this.ydx = -1;
                break;
            case cc.macro.KEY.right:
            case cc.macro.KEY.dpadRight:
                this.ydx = 1;
                break;
        }
    },

    onKeyUp: function onKeyUp(event) {
        switch (event.keyCode) {
            case cc.macro.KEY.up:
            case cc.macro.KEY.dpadUp:
                this.ydy = 0;
                break;
            case cc.macro.KEY.down:
            case cc.macro.KEY.dpadDown:
                this.ydy = 0;
                break;
            case cc.macro.KEY.left:
            case cc.macro.KEY.dpadLeft:
                this.ydx = 0;
                break;
            case cc.macro.KEY.right:
            case cc.macro.KEY.dpadRight:
                this.ydx = 0;
                break;
        }
    },
    update: function update(dt) {
        this.node.x += this.ydsd * this.ydx * dt;
        this.node.y += this.ydsd * this.ydy * dt;
    }
});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=play.js.map
        