"use strict";
cc._RFpush(module, '280c3rsZJJKnZ9RqbALVwtK', 'HelloWorld');
// Script/HelloWorld.js

cc.Class({
    'extends': cc.Component,

    properties: {
        label: {
            'default': null,
            type: cc.Label
        },
        text: 'Hello, World!',
        target: cc.Node,
        speed: 200
    },

    // use this for initialization
    start: function start() {
        this.label.string = this.text;
        // var repeatSeq = [];
        // repeatSeq.push(cc.moveBy(1, 0,500));
        // repeatSeq.push(cc.moveBy(1, 0,-500));

        // this.target.runAction(cc.repeatForever(cc.sequence(repeatSeq)));
    },

    // called every frame
    update: function update(dt) {
        // cc.log(dt);

        var dy = this.speed * dt;
        if (this.target.y < -320) {
            this.speed = 200;
        } else if (this.target.y > 320) {
            this.speed = -200;
        }
        this.target.setPosition(this.target.x, this.target.y + dy);
    },

    onSpeedUp: function onSpeedUp() {
        // cc.director.getScheduler().setTimeScale(2*cc.director.getScheduler().getTimeScale());
        cc.director.originMainLoop = cc.director.mainLoop;
        cc.director.mainLoop = function (deltaTime) {
            // cc.log("hello");
            deltaTime = 2 * deltaTime;
            this.originMainLoop(deltaTime);
        };
    }
});

cc._RFpop();