HZNM.COM
welcome to my space
X
Search:  
 HOME   move control
move control
Published by: webmaster 2010-03-17
Welcome to:hznm.com

  • Hi i'm making flash game and i have some problems. On www.dflame.net/ermac.swf and www.dflame.net/ermac1.fla (source).

    When you press arows for move, Z and X for run my "ermac" move but not good. He must w8 about 2 seconds and then he start move's. I dont know why. Thanks for help.


  • Thanks :) But now when You press AROW or RUN + C or V "ermac" have sliding effect.


  • That's because honestly I didn't take the time to see what the other buttons did; so when you were walking and pressed the kick button the enterframe function was still moving him.

    So for all key strokes where you want him to stop & do an action, i.e. kick, add the delete _root.onEnterFrame.
    Congress Moves To Seize Control Of All US Water::
    Congress Moves To Seize. Control Of All US Water. From Bathtubs To Baptismal Fonts, Congress Moves Wetlands (HR 2421) Bill Gives Corps Control Over Your Property
    http://www.rense.com/general80/cpn.htm
    HOME

    Here is the full code:

    ermacListener = new Object();
    Egypt moves to control border / Riot police struggle to keep ::
    Article:Egypt moves to control border / Riot police struggle to:/c/a/2008/01/26/MNEQULKK9.DTL That move produced international protests and the Hamas
    http://www.sfgate.com/cgi-bin/article.cgi?f=/c/a/2008/01/26/MNEQULKK9.DTL
    HOME
    DflDoc / Control-Control-move | Dprogramming.com Wiki - The D ::
    control. data. drawing. environment. event. filedialog. folderdialog. fontdialog. form. groupbox Describe Control-Control-move here.
    http://wiki.dprogramming.com/DflDoc/Control-Control-move
    HOME
    ermacListener.onKeyDown = function() {
    if (Key.getCode() == 39) {
    _root.onEnterFrame = function() {
    postac._xscale = 100;
    postac.gotoAndStop("chod");
    postac._x += 5;
    };
    } else if (Key.getCode() == 37) {
    _root.onEnterFrame = function() {
    postac._xscale = -100;
    postac._x -= 5;
    postac.gotoAndStop("chod");
    };
    } else if (Key.getCode() == 88) {
    _root.onEnterFrame = function() {
    postac._xscale = +100;
    postac._x += 10;
    postac.gotoAndStop("bieg");
    };
    } else if (Key.getCode() == 90) {
    _root.onEnterFrame = function() {
    postac._xscale = -100;
    postac._x -= 10;
    postac.gotoAndStop("bieg");
    };
    } else if (Key.getCode() == 67) {
    delete _root.onEnterFrame;
    postac.gotoAndStop("LK");
    } else if (Key.getCode() == 86) {
    delete _root.onEnterFrame;
    postac.gotoAndStop("HK");
    } else if (Key.getCode() == 39 or Key.getCode() == 37 and Key.getCode() == 67) {
    delete _root.onEnterFrame;
    postac.gotoAndStop("PolObrot");
    }
    };
    ermacListener.onKeyUp = function() {
    delete _root.onEnterFrame;
    postac.gotoAndStop("stoi");
    };
    Key.addListener(ermacListener);


  • It's because when you press keys such as the right arrow it fires the key once, then delays a second to then keep them repeating.

    The get around this add _root.onEnterFrame function to the keys that cause moment; basically in your actions layer on the main timeline replace ALL the code with this:


    ermacListener = new Object();
    ermacListener.onKeyDown = function() {
    if (Key.getCode() == 39) {
    _root.onEnterFrame = function() {
    postac._xscale = 100;
    postac.gotoAndStop("chod");
    postac._x += 5;
    };
    } else if (Key.getCode() == 37) {
    _root.onEnterFrame = function() {
    postac._xscale = -100;
    postac._x -= 5;
    postac.gotoAndStop("chod");
    };
    } else if (Key.getCode() == 88) {
    _root.onEnterFrame = function() {
    postac._xscale = +100;
    postac._x += 10;
    postac.gotoAndStop("bieg");
    };
    } else if (Key.getCode() == 90) {
    _root.onEnterFrame = function() {
    postac._xscale = -100;
    postac._x -= 10;
    postac.gotoAndStop("bieg");
    };
    } else if (Key.getCode() == 67) {
    postac.gotoAndStop("LK");
    } else if (Key.getCode() == 86) {
    postac.gotoAndStop("HK");
    } else if (Key.getCode() == 39 or Key.getCode() == 37 and Key.getCode() == 67) {
    postac.gotoAndStop("PolObrot");
    }
    };
    ermacListener.onKeyUp = function() {
    delete _root.onEnterFrame;
    postac.gotoAndStop("stoi");
    };
    Key.addListener(ermacListener);


    What I did was:

    Remove the onEnterFrame that was firing the addListener as it only needs to happen once
    Added _root.onEnterFrame functions to each if statement looking for keys for moment
    Added delete _root.onEnterFrame on key up.


  • Steve THX you are the best :)





  • Challenging Books For A 14 Year Old?
    First guitar : acoustic or electric?

    You are looking at:hznm.com's move control, click hznm.com to home
  • date not updating on tpf forum index page
  • forum down
  • another suggestion wedding photography forum
  • quick reply smilies
  • question any tpf buttons
  • question bout inserting hyperlinks
  • forum skins
  • date not updating on tpf forum index page
  • idea 2 tpf shop
  • i was wondering
  • mobile cell phone photography section
  • redirected
  • the new forum info forum
  •  
  • forum down
  • question bout inserting hyperlinks
  • mobile cell phone photography section
  • forum skins
  • the new forum info forum
  • study group
  • idea 2 tpf shop
  • a new forum
  • question any tpf buttons
  • quick reply smilies
  • another suggestion wedding photography forum
  • i was wondering
  • quick replies gone missing
  • a new forum
  •  Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 hznm.com        Site made:CFZ