If you haven't already viewed the following tutorial I suggest you do.
8 Way Movement Tutorial
- First make sure you gave your charector the instance name of "man"
- Then draw your wall (can just be a line if you want)
- Select your wall
- Hit "F8"
- Name your wall and select "Movieclip"
- Then click "OK"
- Now skip to the Action Scripting Section below
You will have to put a different action script based on the way your charector will be hitting the wall (from what side). He can hit it from the top, the bottom, the left, or the right. Choose below and add the opproperiate Action Script.
Hit From Above:
- onClipEvent (enterFrame) {
- if (this.hitTest(_root.man)) {
- _root.map._y -=5;
- }
- }
Hit From Below:
- onClipEvent (enterFrame) {
- if (this.hitTest(_root.man)) {
- _root.map._y +=5;
- }
- }
Hit From Left:
- onClipEvent (enterFrame) {
- if (this.hitTest(_root.man)) {
- _root.map._x +=5;
- }
- }
Hit From Right:
- onClipEvent (enterFrame) {
- if (this.hitTest(_root.man)) {
- _root.map._y -=5;
- }
- }
Thats It, Now Test Your Game/Movie!
Please let me know how this went for you...