A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [MX] Mouse Movement Collision

  1. #1
    Senior Member
    Join Date
    Jul 2008
    Posts
    391

    [MX] Mouse Movement Collision

    You know those games where you press up and down and your guy stops going up if he hits the top wall and the same for the bottom wall? That's what I'm trying to do but with the mouse. Right now I'm trying to make just the top wall. I came up with this and once the guy hits the wall he stops moving.
    PHP Code:
    move=true;
    onEnterFrame = function() {
    if (
    move==true) {
    guy._x=_xmouse;
    guy._y=_ymouse;
    }
    if (
    guy.hitTest(wall)) {
    move=false;
    }

    I don't know how to do it.

  2. #2
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    I think a far better idea would be to restrict the movement of mouse within the region of walls i.e. pre-define the drag area for the movement.....

    Check the attached sample.....apply drag constraints!!!
    Last edited by vinayak.kadam; 08-28-2008 at 02:52 AM.
    As ever,
    Vinayak Kadam

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    I couldn't open that file, only the executable. I use Flash MX and AS2. Maybe you could post the codes for one of the bottles?

  4. #4
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    Also I want the guy to move with the mouse, I don't want to drag him.

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