Skip navigation
infinitus21
Currently Being Moderated

Pacman Like Effect (Left Side To Right Side)

Apr 9, 2012 10:50 AM

I would like a pacman like effect when the character goes outside of the left side of the game window then they come from the right side of the window. My character can only move left and right so they would be using the same left and right parts of the window. I need help on the actionscript for this i am using 2.0 on flash 5

 
Replies
  • Currently Being Moderated
    Apr 9, 2012 3:27 PM   in reply to infinitus21

    You have to continually check the position of the object and when it exceeds the left _X boundary while moving left you just send it to the other side beyond the right boundary.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 7:52 PM   in reply to infinitus21

    Do you have your character moving off to the left?  If so, right after each step of movement you should be checking its _x property to see if it is at a value that puts it off the playing area... just as an example...

     

    character._x -= 3;                               // move to the left

     

    if(character._x < leftboundaryX){      // check if it stepped over the boundary

         character._x = rightboundaryX;    // if so, move it across to the other side

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 14, 2012 7:05 AM   in reply to infinitus21

    You cannot blindly copy code and expect it to work - as stated it was just an example.  You need to define the left boundary and the right boundary values.  You already have the movement code so you don't need my character._x -= 3 line.  You don't want to use "character" at all... you are using "this" instead.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 14, 2012 11:51 AM   in reply to infinitus21

    You use the values (_x) of where the left side ends and the right side ends.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points