A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: movieclips that repel each other?

  1. #1
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80

    movieclips that repel each other?

    Hello to you. I'm looking for some help with a problem. Say i have 2 movieclips on the stage, each movieclip is a ball that bounces around. When the balls come into contact they touch and bounce off in the opposite direction.
    What I'm looking for is for the balls to repel each other, just like magnets repel each other.
    Any help would be great.

  2. #2
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80
    back to the top!

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    depending on your 'bouncing' code (lots of ways to achieve that) it would be pretty much the same than when the balls hit your bounds: revert the direction.
    For example if "ball1._x+=speed" it would become "ball1._x-=speed"

    Posting your original code could help you get more info.
    gparis

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