A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Character Movement (in Flash4)

  1. #1
    ostracized Fruitloops's Avatar
    Join Date
    May 2000
    Location
    Uck
    Posts
    677
    How do you have a character on a straight horizontal line, and have it so when you hit <left> or <right> the character will move one space in that direction? Please help, if you have a .fla can u please send it?

    Thanks for helping.

  2. #2
    Fruitloops, try this:

    On (Key: <Left> )
    Set Variable: "location" = GetProperty ("/character", _x )
    Set Property ("/character", X Position) = location - 10
    End On
    On (Key: <Right> )
    Set Variable: "location" = GetProperty ("/character", _x )
    Set Property ("/character", X Position) = location + 10
    End On

    This assumes your "Character" has an Instance name of "character" and its placed on your main timeline. If it's placed elsewhere, you will have to adjust the reference to it.

    Cheers,

    Markus B

  3. #3
    ostracized Fruitloops's Avatar
    Join Date
    May 2000
    Location
    Uck
    Posts
    677
    Can u put together a working .fla for me please? i tried several times that code u put, but it wont work.

  4. #4
    The Actionscript needs to be attached to a button otherwise it won't work. I apologize, I should have stated this in my post. Place a button in your main timeline. Assign the code above to the button. I either use a Blank button (ie. object in the Hit frame only, or a button with an explanation of what the user needs to do in order to make the character move). Then when you run your movie, your character will move left to right. If you aren't able to get this to work, I'll e-mail you a working demo FLA.

    Cheers,
    Markus B

  5. #5
    ostracized Fruitloops's Avatar
    Join Date
    May 2000
    Location
    Uck
    Posts
    677
    I had it in a button, im not stupid! geez, lol it still doesnt work though

  6. #6
    OK, OK LOL! Check your e-mail.

    Cheers,
    Markus B

  7. #7
    ostracized Fruitloops's Avatar
    Join Date
    May 2000
    Location
    Uck
    Posts
    677
    K, havent got it yet, but i dont know that youve sent it yet

  8. #8
    ostracized Fruitloops's Avatar
    Join Date
    May 2000
    Location
    Uck
    Posts
    677
    K, havent got it yet, but i dont know that youve sent it yet THANK YOU MARK B!

  9. #9
    I went to your homepage and got your e-mail there. To be sure I got it correct, e-mail me at my e-mail address below. If I got it wrong, I'll re-send the FLA.

    Cheers,
    Markus B

  10. #10
    ostracized Fruitloops's Avatar
    Join Date
    May 2000
    Location
    Uck
    Posts
    677
    lol ive been lookin at the wrong email address! hehe I got it, but I haven't finished downloading it yet, but if I have any problems i tell ya. THANKS A BUNCH

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