A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Duck Duck...GOOSE!

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    361
    HEy Yeah thats right im making a simple little duck duck goose game, but no matter how simple i still need help, what i need is, when you pick someone (i can do that) you run by pressing right arrow then left arrow then right arrow then left arrow etc. but i cant do this i need it so you cant just hit left then left again!

    PLease help

    thanx!

    P.S.

    if ya have any cool ideas for a duck dcuk goose game, tell me here!

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    361
    Come on guys i know sometimes it takes a while to answer this stuff but i think some you guys know! come on all i need is how to make the right left right left control!

    thanx!

  3. #3
    Senior Member
    Join Date
    May 2001
    Location
    Sweden
    Posts
    197
    if(Key.isDown(Key.LEFT){
    if(lastdown=="right"){
    run();
    }
    lastdown="left";
    }

    if(Key.isDown(Key.RIGHT){
    if(lastdown=="left"){
    run();
    }
    lastdown="right";
    }

    Something like that?

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    361
    Okay I get it kinda but can you break that code down a little, im not to good with action script!

  5. #5
    Senior Member
    Join Date
    May 2001
    Location
    Sweden
    Posts
    197
    Put the following on your main guy:

    //Run this every new frame.
    onClipEvent(enterFrame){

    //If we're holding down left
    if(Key.isDown(Key.LEFT){
    //If we just pressed right
    if(lastdown=="right"){
    //Insert whatever running script you have here.
    }
    //we just pressed left.
    lastdown="left";
    }

    //If we're holding down left
    if(Key.isDown(Key.RIGHT){
    //If we just pressed left
    if(lastdown=="left"){
    //Insert whatever running script you have here.
    }
    //we just pressed right.
    lastdown="right";
    }

    }

    See it more clearly?
    Ignore the meaningOfLifeX btw. that's just my sig.

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