A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: [Resolved] help w/ ACTUAL MOVING Character Control (UP, DOWN, LEFT, RIGHT)

Hybrid View

  1. #1
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78

    help w/ ACTUAL MOVING Character Control (UP, DOWN, LEFT, RIGHT)

    I understand:
    • how to make a movie clip jump to a position on a key movement
    • how to make a movie cilp jump to another spot when it rolls over another mc. eg a boat over a wave

    but I am looking for something a little more. I would like it to be:
    • When you press up, down, left, or right, rather than have the mc "jump" to a specific spot.
    • when the charachter mc goes over a "wave" mc, it "moves" (not jumps) the charachter movieclip in a certain direcion.

    Could I use a tween, an acionscript for movement (ir there is one)? I have tried many things, but it gets ever so complicated. Please help!!
    Here is a short summary of the game:
    • the charachter moves around w/ the (up, down, left, right, ) keys
    • when the charachter mc (the boat), goes over a "wave" mc, the boat should push the boat a little distance
    • If you have ever played the little puzzle in pokemon red/blue, where you walk around, and certain tiles move you up down left right, this is exactly lke that
    • and No, I dont play pokemon anymore! Just my little brother does!

    If you would like the file, please email me.
    Last edited by stillfunny2u; 02-27-2004 at 11:42 AM.

  2. #2
    Ihoss
    Guest
    and No, I dont play pokemon anymore! Just my little brother does
    lol, we belive you

    i asume you know what the _x and _y variable does, and what +=5; does. if you want the boat to move when you press a key, just use this:
    code:

    _x+=5;
    //or
    _y+=5;



    then just use those for the key and when the wave hits it

    good luck, and welcome to Flashkit

  3. #3
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    Thie is what I have for my actionscript on the boat:
    onClipEvent (enterFrame) {
    //when the user presses 'up', the boat goes up
    if(Key.isDown(Key.UP)) {
    if(direction=="up"){
    this._y -=36;
    }
    else {
    this._rotation=0
    direction = "up";
    }
    }
    // added _rotation modifier- so it looks like it is going up or down when you press the arrows
    //when the user presses 'down', the boat goes down
    if(Key.isDown(Key.DOWN)) {
    if(direction=="down"){
    this._y +=36;
    }
    else {
    this._rotation=180
    direction = "down";
    }
    }

    //when the user presses 'left', the boat goes left
    if(Key.isDown(Key.LEFT)) {
    if(direction=="left"){
    this._x -=36;
    }
    else {
    this._rotation=270
    direction = "left";
    }


    }

    //when the user presses 'right', the boat goes right
    if(Key.isDown(Key.RIGHT)) {
    if(direction=="right"){
    this._x +=36;
    }
    else {
    this._rotation=90
    direction = "right";
    }
    }

    }



    This is pretty much what you have, exept mine has
    this._x, not _x;. I want the user to be able to tap up, then have the boat, MOVE, up, not just go "dun!" and make it just jump.
    Attached Files Attached Files

  4. #4
    Ihoss
    Guest
    that is a frame rate problem you have there. -36 is quite a lot, and i guess you have the standard frame rate of 12. change the frame rate to 30 or 40 and the _x+=5. then it will look smoother.

    Edit: aha, tilebased. forget what i said. i think tonypa has some stuff on this. i came up with a way to do it though:

  5. #5
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    i mean, maybe on the first frame have a movieclip, then have a tween. then when you press up, it plays the movie moving the movieclip? but how could it move to a different spot each time? I want the mc to move to _x+36, not just in an instant be there.

  6. #6
    Ihoss
    Guest
    here is the upload:
    Attached Files Attached Files

  7. #7
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    THANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTH ANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHAN KYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKY OUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOU THANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOU

  8. #8
    Ihoss
    Guest
    ANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEA NYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEAN YTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANY TIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYT IMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTI MEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIMEANYTIM EANYTIMEANYTIMEANYTIME









    just not tomorrow...

  9. #9
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    just one tiny little problem, how do i know whats going on so that I can edit it, like if I wanted to make more waves?

  10. #10
    Ihoss
    Guest
    what is it you dont understand? just so its easier to explain (it wasnt meant to be rude )

  11. #11
    Senior Member
    Join Date
    Jan 2004
    Posts
    366
    Originally posted by stillfunny2u
    just one tiny little problem, how do i know whats going on so that I can edit it, like if I wanted to make more waves?
    Just a quick question did you just copy and paste that code or did you actually write it out?

    And I cant really say how to add more waves without actually knowing how you make waves in first place. You only posted the movement code.

  12. #12
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    These are my questions:
    [list=1][*]What does the "s" variable do?[*]How did you change it to "xs" and "ys"?[*]What does the "pos" variable mean?[*]If I wanted to add more "waves", how would I do so? (I guess I probably could figure that one out myself, if I understood how it all worked)[/list=1]
    Just for some background info, this is going to be used for a puzzle in a game I am making. The game is a rpg/puzzle game inspired by Myst, Mystery of Time and Space (MOTAS), and The Curse of Monkey Island.

    When I finish the entire game(which at the rate I'm going, will be when I'm 60), I will post it in the forums.

    One more thing, if you don't want to answer this you don't have to:

    What kind of position are you in that you can just be on your computer all day long, answering requests like mine?
    (believe me, I would die for that life )

    Oh yeah, one more "one more thing", Thanks again, for all that you have done to help me!!

  13. #13
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    HeyArrowFlash, copied and pasted that, but I did not use the "click and drag" method to write it, it just takes too long.
    Last edited by stillfunny2u; 02-28-2004 at 09:13 PM.

  14. #14
    Senior Member
    Join Date
    Jan 2004
    Posts
    366
    excuse me I didnt see it was attached. do0tn be a jack***.

  15. #15
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Hey, hey, no need to be rude

    You can always use "edit" button if you have made mistake in your post. Or delete the post altogether.

  16. #16
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    In these forums you cant tell when somebody is joking! Hey I'm sorry {COLOR=blue]Arrowflash[/COLOR]. .
    Last edited by stillfunny2u; 02-28-2004 at 09:15 PM.

  17. #17
    Ihoss
    Guest
    calm down guys, no name calling here

    1) the s variable is the speed you want the boat to move at. thei higher it is, the faster the boat moves, but the more it "jumps"
    2) it wasnt hard chanign it to xs and ys
    3) pos is just for checking if the boat has traveled far enough. there are 36 pixels between one tile and the next, so when pos==36, it is at the next tile and the moving should be stopped.
    4) good question. i would sugest using a 2d array and learning tilebased game making. hunt down tonypa for that

  18. #18
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    you've answered all of my questions, but what I meant by #2 was, what does xs and yx mean?

  19. #19
    Ihoss
    Guest
    xs and ys is the speed and the direction controler. if xs is positive, it will move to the right and if it isnt, it will move to the left. if ys is positive, it wil move down, and if it isnt, it will move up.

  20. #20
    GoldMember
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    78
    for the last time thank you,
    Last edited by stillfunny2u; 02-28-2004 at 09:17 PM.

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