A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Aircraft shot (please help)

  1. #1
    Junior Member
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    23

    Aircraft shot (please help)

    Hello folks,

    I´ve got a little problem with this script:

    onClipEvent(enterFrame){
    while (Key.isDown(Key.SPACE) && _currentframe == 1) {
    gotoAndPlay("fire");
    }
    }


    Well, the shot works for a while...

    What can i do for?




  2. #2
    not a free man 51055's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    120
    I'm not an expert on this, but are you sure you need to use while? As the goto can only happen once in the script, wouldn't if work better?

  3. #3
    Junior Member
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    23
    Right! that "while" was there by nothing...in fact, it´s becouse i was trying something else before...sorry...

    onClipEvent(enterFrame){
    if (Key.isDown(Key.SPACE) && _currentframe == 1) {
    gotoAndPlay("fire");
    }
    }

    So...i discovery something else...the shot just stop when i press the SPACE to quick...

  4. #4
    Junior Member
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    23
    Originally posted by methark
    So...i discovery something else...the shot just stop when i press the SPACE to quick...
    That was bad!

    I´ve discovered something else...(i´s that right?)

  5. #5
    Senior Member
    Join Date
    Jul 2002
    Location
    Slovenia
    Posts
    193
    It stops shooting, because each time when you press the SPACE key the movie clip jumps to specific frame (named "fire"). Hence, the animation doesn't have time to finish before you hit the SPACE key again.

    You should investigate other methods of firing...

    Good luck

  6. #6
    Junior Member
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    23

    Simple

    Well folks...

    My solution was simple and nice... The code are not so different of the firt...was just a case to ajust the lines...



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center