# Spell in action

**URL:** <https://forum.kirupa.com/t/spell-in-action/217961>\
**Category:** programming\
**Created:** [March 3, 2007, 3:41pm UTC](https://forum.kirupa.com/t/spell-in-action/217961 "2007-03-03T15:41:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dflame](https://avatars.discourse-cdn.com/v4/letter/d/5fc32e/32.png) [@dflame](https://forum.kirupa.com/u/dflame)\
**Post date:** [March 3, 2007, 3:41pm UTC](https://forum.kirupa.com/t/spell-in-action/217961/1 "2007-03-03T15:41:47Z")

</div>

Hello i have problem. On [www.flexible.com.pl/ken.swf](http://www.flexible.com.pl/ken.swf) u see “ken”. Move with arrows and Punch - A, S  
Kick - Z, X

When u will press down, down + Z you will have spell animation. But you must stay with key Z to see spell. How to make that when i will press down, down + z spell will fly but i can do other things with my “ken”. Pls help me.

On bottom Action Script Code.

```auto
superBar = 0;
combo = 0; // odpowiada za podwojny cios
g = 0; // odpowiada za podwojny cios

combo1 = 0;
g1 = 0;

h = 0;
kuca = 0;

h1 = 0;
gora = 0;

nasluch = new Object();
nasluchB = new Object();

nasluchB.onKeyDown = function() {
    

    
    if (g == 0 && Key.getCode() == 65) {
        bar._xscale += 2;
        superBar += 2;
        combo++;
        g+=2;
        kuca = 0;
        gora = 0;
        postac.gotoAndStop("punch");
        
        
};
    
    if (combo == 3 && g == 2 && Key.getCode() == 65) {
        postac.gotoAndStop("punchB");
        bar._xscale += 3;
        superBar += 3;
        kuca = 0;
        gora = 0;
        combo1 = 0;
};
    
        if (combo >= 3) {
            kuca = 0;
            combo = 0;
            combo1 = 0;
};

    if (g1 == 0 && Key.getCode() == 90) {
        bar._xscale += 2;
        superBar += 2;
        combo1++;
        g1+=2;
        postac.gotoAndStop("kick");
        combo = 0;
        kuca = 0;
};
    if (combo1 == 3 && g1 == 2 && Key.getCode() == 90) {
        postac.gotoAndStop("kickB");
        bar._xscale += 3;
        superBar += 3;
        kuca = 0;
        combo = 0;
};
    
        if (combo1 >= 3) {
            combo1 = 0;
            combo = 0;
};

    if (Key.getCode() == 88) {
        _root.onEnterFrame = function() {
        bar._xscale += 2;
        superBar += 2;
        postac.gotoAndStop("kickC");
        combo = 0;
        kuca = 0;
        }
};

};

nasluch.onKeyDown = function() {
 
    if (Key.getCode() == 39) { // CHOD
      _root.onEnterFrame = function() {
    postac._xscale = 120;
       postac.gotoAndStop("chod");
       postac._x += 10;
    combo=0;
    combo1 = 0;
    kuca = 0;
    
      }
}

    if (Key.getCode() == 37) { // CHOD
      _root.onEnterFrame = function() {
    postac._xscale = -120;
       postac._x -= 10;
       postac.gotoAndStop("chod");
    combo=0;
    combo1 = 0;
    kuca = 0;
      }
}
        if (Key.getCode() == 83) {
            _root.onEnterFrame = function() {
            bar._xscale += 2;
            superBar += 2;
            postac.gotoAndStop("punchC");
            kuca = 0;
            combo1 = 0;
            combo = 0;
            
            }
};
    if (Key.getCode() == 38) { // GORA
      _root.onEnterFrame = function() {
    combo1 = 0;
    combo = 0;
    gora++;
    kuca = 0;
      }
}
    if (gora == 2 && Key.getCode() == 90) {
        _root.onEnterFrame = function() {
        postac.gotoAndStop ("kickLa");
        gora = 0;
        kuca = 0;
        combo = 0;
        combo1 = 0;
        }
    };
    if (gora >= 2) {
        gora = 0;
        kuca = 0;
        combo = 0;
        combo1 = 0;
    }
    if (Key.getCode() == 40) { // KUCA
      _root.onEnterFrame = function() {
    combo1 = 0;
    combo = 0;
    kuca++;
    gora = 0;
      }
}
    if (kuca == 2 && Key.getCode() == 65) {
        _root.onEnterFrame = function() {
        postac.gotoAndStop ("shodo");
        gora = 0;
        kuca = 0;
        combo = 0;
        combo1 = 0;
        }
    };
    if (kuca >= 2) {
        gora = 0;
        kuca = 0;
        combo = 0;
        combo1 = 0;
    }
};
    

    nasluch.onKeyUp = function() {
     delete _root.onEnterFrame;
    g = 0;
    g1 = 0;
    postac.gotoAndStop("stoi");

    
};
    nasluchB.onKeyUp = function() {
};

Key.addListener(nasluch);
Key.addListener(nasluchB);

```
