Walking around in Scenes
I have gotten a few advice and I been trying to do this for 4 hours and I still have gotten it to work. Sniff.
I want a person to walk through a door and go into a next scence(or Level) corresponding to the door. I was succusful attaching person from the library and making him to move into next scene however when came into the next scene he froze. But know I dont know how I did that. My person now stays in the same scene and loads from same area and does not move. I have been experimenting with everything. I have made 4 scences or levels with frame labels. I been careful with instances names. For some reason the hitTest on the door doesnt work. on the person. Can someone please help me.
I have had help but it didnt work. This is what I have done.
I have created four rooms(each are different Scenes named Level1, Level2(also I have named frame levels as Level1 Level2 and so on) and so on). As the person walks around he goes through doors(which are hitTest) that leads into different rooms. The promblem is that the person is always where I have placed him on the stage. I want the person to be at the corresponding door that he comes through.
I was suggest to use this action script but it gave me werid result that it moved the door to different position. on the stage
else if (_root.door.hitTest(_x, _y, true)) {
_root.prevFrame();
_root.box._x = 100; //use the x coordinates here
_root.box._y = 100; //use the y coordinates here
Is there a way I can load the person from the library to corresponding door that he comes through. How do I that? Look at Scene Level2. Thanks for the help. I can send photos of the scences.
//THIS ATTACHED TO PERSON
// The Speed of the move
onClipEvent (load) {
moveSpeed = 15;
}
// Code to move the object
onClipEvent (enterFrame) {
if(_root.changingroom){
_root.changingroom=false;
this._x=_root.goto_x;
this._y=_root.goto_y;
}
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
}
if (Key.isDown(Key.DOWN)) {
this._y += moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y -= moveSpeed;
}
if (_root.door.hitTest(_x, _y, true)) {
gotoAndPlay("Level2", 1);
_root.changingroom=true;
_root.goto_x=123;
_root.goto_y=123;
}
}
//THIS ATTACHED TO PERSON
//THIS ATTACHED TO PERSON
//THIS ATTACHED TO PERSON
// The Speed of the move
onClipEvent (load) {
moveSpeed = 15;
}
// Code to move the object
onClipEvent (enterFrame) {
if(_root.changingroom){
_root.changingroom=false;
this._x=_root.goto_x;
this._y=_root.goto_y;
}
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
}
if (Key.isDown(Key.DOWN)) {
this._y += moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y -= moveSpeed;
}
if (_root.door.hitTest(_x, _y, true)) {
gotoAndPlay("Level2", 1);
_root.changingroom=true;
_root.goto_x=123;
_root.goto_y=123;
}
//THIS ATTACHED TO THE DOOR
onClipEvent(enterFrame) {
if (_root.hero.hitTest(_x, _y, true)) {
gotoAndPlay("Level2", 1);
_root.changingroom=true;
_root.goto._x=123;
_root.goto._y=123;
}
}
//THIS ATTACHED TO FIRST FRAME OF EACH SCENE
_root.attachMovie("hero", "hero1", 5);
_root.hero1._x = 123;
_root.hero1._y = 123;
}