Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 92756

Re: How do i assign a keyboard function to a buttton created.

$
0
0

//  Action tag #1

 

 

stop();

_root.dropsoundon = 0;

_root.shrinkamount = 0.1;

_root.gamepaused = 0;

_root.wobbleamount = 0;

_root.moveamount = 1;

_root.combobonus = 100;

_root.combonumber = 0;

_root.panamount = 0.1;

_root.blocknumber = 0;

_root.score = 0;

_root.lives = 3;

_root.blockplaced = 0;

_root.blockpositions = new Array();

makeblock();

_global.placeblock = function ()

{

    _root.towerheight = 0;

    _root.towermove = 1;

    _root.blockplaced = 0;

    _root.blocknumber = _root.blocknumber + 1;

    _root.dropsoundon = 0;

    makeblock();

}

;

_global.lifelost = function ()

{

    if (_root.lives > 1)

    {

        _root.lives = _root.lives - 1;

        _root.lifelostmovie.gotoAndPlay(2);

        return undefined;

    }

    explosion = _root.attachMovie("explosion", "explosion", 400);

    explosion._x = _root.objcell_mc.ship._x + 250;

    explosion._y = _root.objcell_mc.ship._y + 250;

    _root.objcell_mc.removeMovieClip(this);

    _root.towershrink = 1;

    _root.gameovermovie.play();

}

;

_root.attachMovie("shaker", "shaker", 50000);

_root.shaker._x = -45;

_root.shaker._y = -40;

_root.shaker.theshake.thecombobar._visible = 0;

_root.attachMovie("lifelostmovie", "lifelostmovie", 50001);

_root.lifelostmovie._x = 200;

_root.lifelostmovie._y = 280;

_root.attachMovie("combolost", "combolost", 50002);

_root.combolost._x = 300;

_root.combolost._y = 500;

_root.attachMovie("pausedmovie", "pausedmovie", 50003);

_root.pausedmovie._x = -450;

_root.pausedmovie._y = 300;

_root.attachMovie("gameovermovie", "gameovermovie", 50004);

_root.gameovermovie._x = 200;

_root.gameovermovie._y = 280;

 

 

//  ClipEvent 213:1

//    On enterFrame

onClipEvent(enterFrame)

{

    if (_root.gamepaused == 0)

    {

        _root.towermovex = _root.thetower._x - _root.SW / 2;

        if (_root.blocknumber == 0)

        {

            _root.objcell_mc.ship.block.gotoAndStop(1);

        }

        else

        {

            _root.objcell_mc.ship.block.gotoAndStop(2);

        }

        _root.shaker.theshake.thecombobar.combobar._xscale = _root.combobonus;

        if (_root.combonumber > 0)

        {

            _root.combobonus = _root.combobonus - 0.3;

        }

        if (_root.combobonus <= 0)

        {

            _root.shaker.theshake.thecombobar._visible = 0;

            _root.combonumber = 0;

            _root.combobonus = 100;

            _root.combolost.gotoAndPlay(2);

        }

        _root.windstrength = _root.blocknumber;

        if (_root.blockplaced == 0)

        {

            if (_root.objcell_mc.ship._y < -200)

            {

                _root.blockrise = 1;

            }

            else if (_root.objcell_mc.ship._y > -150)

            {

                _root.blockrise = 0;

            }

            if (_root.objcell_mc.ship._x > _root.blocknumber / 3 + 10)

            {

                _root.blockdirection = 1;

            }

            else if (_root.objcell_mc.ship._x < 0 - _root.blocknumber / 3 + 10)

            {

                _root.blockdirection = 0;

            }

            if (_root.blockrise == 1)

            {

                _root.objcell_mc.ship.vy = _root.objcell_mc.ship.vy + (0.15 + _root.blocknumber / 500);

            }

            else

            {

                _root.objcell_mc.ship.vy = _root.objcell_mc.ship.vy - (0.15 + _root.blocknumber / 500);

            }

            if (_root.blockdirection == 1)

            {

                _root.objcell_mc.ship.vx = _root.objcell_mc.ship.vx - (0.2 + _root.blocknumber / 500);

            }

            else

            {

                _root.objcell_mc.ship.vx = _root.objcell_mc.ship.vx + (0.2 + _root.blocknumber / 500);

            }

        }

        else

        {

            if (_root.dropsoundon == 0)

            {

                var randomnote = Math.random();

                if (randomnote >= 0.86)

                {

                    dropsound = new Sound(this);

                    dropsound.attachSound("piano1");

                    dropsound.start(0, 1);

                }

                else if (randomnote >= 0.72)

                {

                    dropsound = new Sound(this);

                    dropsound.attachSound("piano2");

                    dropsound.start(0, 1);

                }

                else if (randomnote >= 0.58)

                {

                    dropsound = new Sound(this);

                    dropsound.attachSound("piano3");

                    dropsound.start(0, 1);

                }

                else if (randomnote >= 0.44)

                {

                    dropsound = new Sound(this);

                    dropsound.attachSound("piano4");

                    dropsound.start(0, 1);

                }

                else if (randomnote >= 0.3)

                {

                    dropsound = new Sound(this);

                    dropsound.attachSound("piano5");

                    dropsound.start(0, 1);

                }

                else if (randomnote >= 0.16)

                {

                    dropsound = new Sound(this);

                    dropsound.attachSound("piano6");

                    dropsound.start(0, 1);

                }

                else

                {

                    dropsound = new Sound(this);

                    dropsound.attachSound("piano7");

                    dropsound.start(0, 1);

                }

                _root.dropsoundon = 1;

            }

            _root.objcell_mc.ship.vy = _root.objcell_mc.ship.vy + 1;

        }

        if (_root.wobbleamount > 0.3)

        {

            if (_root.thetower._x < 290 - 10 * _root.wobbleamount)

            {

                _root.towerdirection = 1;

            }

            else if (_root.thetower._x > 310 + 30 * _root.wobbleamount)

            {

                _root.towerdirection = 0;

            }

            if (_root.towerdirection == 1)

            {

                _root.thetower._x = _root.thetower._x + (_root.wobbleamount + _root.blocknumber / 100);

                _root.thetower["block" + (_root.blocknumber - 1)]._rotation = _root.thetower["block" + (_root.blocknumber - 1)]._rotation + 0.1;

                _root.thetower["block" + (_root.blocknumber - 1)]._x = _root.toweramountx;

                _root.thetower["block" + (_root.blocknumber - 2)]._rotation = _root.thetower["block" + (_root.blocknumber - 2)]._rotation + 0.1;

                _root.thetower["block" + (_root.blocknumber - 2)]._x = _root.toweramountx;

            }

            else

            {

                _root.thetower._x = _root.thetower._x - (_root.wobbleamount + _root.blocknumber / 100);

                _root.thetower["block" + (_root.blocknumber - 1)]._rotation = _root.thetower["block" + (_root.blocknumber - 1)]._rotation - 0.1;

                _root.thetower["block" + (_root.blocknumber - 1)]._x = _root.toweramountx;

                _root.thetower["block" + (_root.blocknumber - 2)]._rotation = _root.thetower["block" + (_root.blocknumber - 2)]._rotation - 0.1;

                _root.thetower["block" + (_root.blocknumber - 2)]._x = _root.toweramountx;

            }

        }

        if (Key.isDown(32))

        {

            _root.blockplaced = 1;

            _root.objcell_mc.ship.rope._visible = false;

        }

        if (_root.towermove == 1)

        {

            if (_root.towerheight < 100)

            {

                _root.thetowerback._y = _root.thetowerback._y + _root.moveamount;

                _root.thetower._y = _root.thetower._y + _root.moveamount;

                _root.towerheight = _root.towerheight + _root.moveamount;

                _root.moveamount = _root.moveamount + 2;

            }

            else

            {

                _root.towermove = 0;

                _root.towerheight = 0;

                _root.moveamount = 1;

            }

        }

        _root.dropheight = 20;

        if (_root.objcell_mc.ship._y > _root.dropheight)

        {

            _root.blockpositions[_root.blocknumber] = _root.objcell_mc.ship._x - _root.towermovex;

            if (_root.blocknumber == 0)

            {

                _root.score = _root.score + 50;

                myblock = _root.thetower.attachMovie("block", "block" + _root.blocknumber, 50 + _root.blocknumber);

                myblock._x = _root.blockpositions[_root.blocknumber];

                myblock._y = _root.dropheight - _root.blocknumber * 100;

                _root.shaker.gotoAndPlay("lighthit");

                placeblock();

            }

            else if (0 != _root.blockpositions[_root.blocknumber] < _root.blockpositions[_root.blocknumber - 1] + 10 & 0 != _root.blockpositions[_root.blocknumber] > _root.blockpositions[_root.blocknumber - 1] - 10)

            {

                trace("Perfect");

                _root.wobbleamount = _root.wobbleamount / 2;

                _root.combonumber = _root.combonumber + 1;

                if (_root.combobonus <= 75)

                {

                    _root.combobonus = _root.combobonus + 25;

                }

                else

                {

                    _root.combobonus = 100;

                }

                _root.shaker.gotoAndPlay(1);

                _root.shaker.theshake.thecombobar._visible = 1;

                _root.score = _root.score + 100 * _root.blocknumber;

                randomcheer = Math.random();

                if (randomcheer > 0.8)

                {

                    _root.messageword = "NICE";

                }

                else if (randomcheer > 0.6)

                {

                    _root.messageword = "BRICKIN COOL";

                }

                else if (randomcheer > 0.4)

                {

                    _root.messageword = "UBER AIM";

                }

                else if (randomcheer > 0.2)

                {

                    _root.messageword = "WICKED AIM";

                }

                _root.messageUp.gotoAndPlay(2);

                _root.shaker.theshake.combobonus.gotoAndPlay(2);

                myblock = _root.thetower.attachMovie("block", "block" + _root.blocknumber, 50 + _root.blocknumber);

                myblock._x = _root.blockpositions[_root.blocknumber - 1];

                myblock._y = _root.dropheight - _root.blocknumber * 100;

                myblock.attachMovie("perfecteffect", "perfecteffect", 40000);

                myblock.perfecteffect._x = -50;

                myblock.perfecteffect._y = 100;

                _root.effectx = 50;

                myblock.attachMovie("perfecteffect1", "perfecteffect1", 40001);

                myblock.perfecteffect1._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                myblock.perfecteffect1._y = 100;

                myblock.perfecteffect1._rotation = random(300);

                myblock.attachMovie("perfecteffect1", "perfecteffect2", 40002);

                myblock.perfecteffect2._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                myblock.perfecteffect2._y = 100;

                myblock.perfecteffect2._rotation = random(300);

                myblock.attachMovie("perfecteffect1", "perfecteffect3", 40003);

                myblock.perfecteffect3._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                myblock.perfecteffect3._y = 100;

                myblock.perfecteffect3._rotation = random(300);

                myblock.attachMovie("perfecteffect1", "perfecteffect4", 40004);

                myblock.perfecteffect4._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                myblock.perfecteffect4._y = 100;

                myblock.perfecteffect4._rotation = random(300);

                myblock.attachMovie("perfecteffect1", "perfecteffect5", 40005);

                myblock.perfecteffect5._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                myblock.perfecteffect5._y = 100;

                myblock.perfecteffect5._rotation = random(300);

                if (_root.blocknumber == 0)

                {

                    myblock.gotoAndStop(1);

                }

                else

                {

                    myblock.gotoAndStop(2);

                }

                _root.blockpositions[_root.blocknumber] = myblock._x;

                placeblock();

            }

            else if (!(0 != _root.blockpositions[_root.blocknumber] < _root.blockpositions[_root.blocknumber - 1] - 100 | 0 != _root.blockpositions[_root.blocknumber] > _root.blockpositions[_root.blocknumber - 1] + 100))

            {

                if (_root.blockpositions[_root.blocknumber] < _root.blockpositions[_root.blocknumber - 1] - 50)

                {

                    myblockfall = _root.objcell_mc.attachMovie("blockleft", "blockleft", 15);

                    myblockfall._x = _root.objcell_mc.ship._x;

                    myblockfall._y = _root.objcell_mc.ship._y;

                    if (_root.blocknumber == 0)

                    {

                        myblockfall.theblock.block.gotoAndPlay(1);

                    }

                    else

                    {

                        myblockfall.theblock.block.gotoAndPlay(2);

                    }

                    _root.shaker.gotoAndPlay("blockhitleft");

                    trace("oh noooo fall left");

                    myblockfall.attachMovie("dust", "dust", 40000);

                    myblockfall.dust._x = -50;

                    myblockfall.dust._y = 100;

                    _root.effectx = 50;

                    myblockfall.attachMovie("dust", "dust1", 40001);

                    myblockfall.dust1._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust1._y = 100;

                    myblockfall.dust1._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust2", 40002);

                    myblockfall.dust2._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust2._y = 100;

                    myblockfall.dust2._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust3", 40003);

                    myblockfall.dust3._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust3._y = 100;

                    myblockfall.dust3._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust4", 40004);

                    myblockfall.dust4._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust4._y = 100;

                    myblockfall.dust4._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust5", 40005);

                    myblockfall.dust5._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust5._y = 100;

                    myblockfall.dust5._rotation = random(300);

                    if (randomcheer > 0.8)

                    {

                        _root.messageword = "WATCH OUT";

                    }

                    else if (randomcheer > 0.6)

                    {

                        _root.messageword = "BELOW";

                    }

                    else if (randomcheer > 0.4)

                    {

                        _root.messageword = "BOOOOO";

                    }

                    else if (randomcheer > 0.2)

                    {

                        _root.messageword = "NOOOOOO";

                    }

                    else

                    {

                        _root.messageword = "CAREFUL";

                    }

                    _root.messageUp.gotoAndPlay(2);

                    _root.blockplaced = 0;

                    lifelost();

                    makeblock();

                }

                else if (_root.blockpositions[_root.blocknumber] > _root.blockpositions[_root.blocknumber - 1] + 50)

                {

                    myblockfall = _root.objcell_mc.attachMovie("blockright", "blockright", 15);

                    myblockfall._x = _root.objcell_mc.ship._x;

                    myblockfall._y = _root.objcell_mc.ship._y;

                    if (_root.blocknumber == 0)

                    {

                        myblockfall.theblock.block.gotoAndPlay(1);

                    }

                    else

                    {

                        myblockfall.theblock.block.gotoAndPlay(2);

                    }

                    myblockfall.attachMovie("dust", "dust", 40000);

                    myblockfall.dust._x = -50;

                    myblockfall.dust._y = 100;

                    _root.effectx = 50;

                    myblockfall.attachMovie("dust", "dust1", 40001);

                    myblockfall.dust1._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust1._y = 100;

                    myblockfall.dust1._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust2", 40002);

                    myblockfall.dust2._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust2._y = 100;

                    myblockfall.dust2._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust3", 40003);

                    myblockfall.dust3._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust3._y = 100;

                    myblockfall.dust3._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust4", 40004);

                    myblockfall.dust4._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust4._y = 100;

                    myblockfall.dust4._rotation = random(300);

                    myblockfall.attachMovie("dust", "dust5", 40005);

                    myblockfall.dust5._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblockfall.dust5._y = 100;

                    myblockfall.dust5._rotation = random(300);

                    _root.shaker.gotoAndPlay("blockhitright");

                    randomcheer = Math.random();

                    if (randomcheer > 0.8)

                    {

                        _root.messageword = "WATCH OUT";

                    }

                    else if (randomcheer > 0.6)

                    {

                        _root.messageword = "BELOW";

                    }

                    else if (randomcheer > 0.4)

                    {

                        _root.messageword = "BOOOOO";

                    }

                    else if (randomcheer > 0.2)

                    {

                        _root.messageword = "NOOOOOO";

                    }

                    else

                    {

                        _root.messageword = "CAREFUL";

                    }

                    _root.messageUp.gotoAndPlay(2);

                    trace("oh noooo fall right");

                    _root.blockplaced = 0;

                    lifelost();

                    makeblock();

                }

                else

                {

                    _root.blockprecision = _root.blockpositions[_root.blocknumber] - _root.blockpositions[_root.blocknumber - 1];

                    _root.blockprecision = _root.blockprecision / 100;

                    if (_root.blockprecision < 0)

                    {

                        _root.blockprecision = _root.blockprecision * -1;

                    }

                    normaldropsound = new Sound(this);

                    normaldropsound.attachSound("normaldrop");

                    normaldropsound.start(0, 1);

                    trace(_root.blockprecision);

                    _root.wobbleamount = _root.wobbleamount + _root.blockprecision;

                    _root.score = _root.score + 20 * _root.blocknumber;

                    myblock = _root.thetower.attachMovie("block", "block" + _root.blocknumber, 50 + _root.blocknumber);

                    myblock._x = _root.blockpositions[_root.blocknumber];

                    myblock._y = _root.dropheight - _root.blocknumber * 100;

                    myblockfall.attachMovie("dust", "dust", 40000);

                    myblockfall.dust._x = -50;

                    myblockfall.dust._y = 100;

                    _root.effectx = 50;

                    myblock.attachMovie("dust", "dust1", 40001);

                    myblock.dust1._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblock.dust1._y = 100;

                    myblock.dust1._rotation = random(300);

                    myblock.attachMovie("dust", "dust2", 40002);

                    myblock.dust2._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblock.dust2._y = 100;

                    myblock.dust2._rotation = random(300);

                    myblock.attachMovie("dust", "dust3", 40003);

                    myblock.dust3._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblock.dust3._y = 100;

                    myblock.dust3._rotation = random(300);

                    myblock.attachMovie("dust", "dust4", 40004);

                    myblock.dust4._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblock.dust4._y = 100;

                    myblock.dust4._rotation = random(300);

                    myblock.attachMovie("dust", "dust5", 40005);

                    myblock.dust5._x = 0 - _root.effectx + Math.floor(Math.random() * (_root.effectx - (0 - _root.effectx) + 1));

                    myblock.dust5._y = 100;

                    myblock.dust5._rotation = random(300);

                    if (_root.blocknumber == 0)

                    {

                        myblock.gotoAndStop(1);

                    }

                    else

                    {

                        myblock.gotoAndStop(2);

                    }

                    _root.shaker.gotoAndPlay("lighthit");

                    placeblock();

                }

            }

        }

        if (_root.objcell_mc.ship._y > 300)

        {

            _root.shaker.gotoAndPlay("freefall");

            _root.blockplaced = 0;

            if (randomcheer > 0.8)

            {

                _root.messageword = "WATCH OUT";

            }

            else if (randomcheer > 0.6)

            {

                _root.messageword = "BELOW";

            }

            else if (randomcheer > 0.4)

            {

                _root.messageword = "BOOOOO";

            }

            else if (randomcheer > 0.2)

            {

                _root.messageword = "NOOOOOO";

            }

            else

            {

                _root.messageword = "CAREFUL";

            }

            _root.messageUp.gotoAndPlay(2);

            lifelost();

            makeblock();

            trace("total miss");

        }

    }

    if (Key.isDown(80))


Viewing all articles
Browse latest Browse all 92756

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>