A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Arrrrrg!

  1. #1
    Member
    Join Date
    Mar 2004
    Location
    Florida :)
    Posts
    57

    Arrrrrg!

    For two days now I have been struggling and posting continuously. If there is any one out ther that might be able to help me make an object randomly move around the screen, not just jump from place to place but actually move. I have trie this script.

    onCLipEvent(enterFrame){
    Xspeed = 5;
    Yspeed = 5;
    this._x = random (Xspeed)+5;
    this._y = random (Yspeed)+5;
    }


    but this just makes him go up, up, up, and away.
    Help plz.
    ScOtT

  2. #2
    Senior Member Genesis F5's Avatar
    Join Date
    Jan 2002
    Location
    Unallocated memory
    Posts
    1,845
    Lol, hello again. Common problem, simple solution.

    Basically what you're doing is generating a random coordinate and then your character moves to that spot without actually having a fluid movement, or as some call it, "easing" to that spot.

    What you need to do is use that random coordinate to act as a target/objective for your character to move to. Below is an example of what I mean. Basically, it generates a random coordinate, turns to its objective point and then goes to that point.

    -Hope this helps you. Good luck.

    -genesis f5 (mx)

  3. #3
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    As a side note, the easing tutorial on bit-101.com works wonders for this type of movement. It's also very thorough, and you'll probably pick up a thing or two.

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