PDA

Click to See Complete Forum and Search --> : Question about Boundaries and character moving around scenes



-=FYProject=-
12-29-2005, 11:05 AM
Hi,

Sorry to trouble you guys again, thanks for the great advice some of you have given me. Well i am facing some queries, hope you guys can help me out.

First
I have written codes for boundaries/walls that it should let the moving character stay in the space in it, but after some tries, it still fails.

My character code:
onClipEvent (load) {
moveSpeed = 3;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y -= moveSpeed;
} else if (Key.isDown(Key.DOWN)) {
this._y += moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
}
}

My walls/boundaries code:

Wall 1:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall))
{ _x = _x+10;
}
}

Wall 2:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall2))
{ _y = _y+10;
}
}

Wall 3:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall3))
{ _y = _y-10;
}
}

Wall 4:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall4))
{ _y = _y-10;
}
}

Done. As for after a few tries, my character will move out of the walls and cannot stay in the visable area. Am i on the right track?

Second
I want to make my character move from scene to scene. I started by creating a door and follow a game tutorial help and try to use it. I also create another door and set the codes as taught so that the character would appear on the second position. but when i reach the door on the first scene, it does not change the scene. Can i ask how should i do or what codes i should set so that when my character step on the door/portal, it will switch the player to the next screen/map.

Third

Can i create a button and set a diameter/radius around it(e.g a telephone booth set as a button function) and when the character in the story move to the diameter of the button, it will be able to select the function if let say we press an enter key in the moblie device. (e.g when the character move to the detect space of the telephone booth, it is able to use the next scene i set for the telephone booth).

Thank you for answering my queries and spending your time reading, your help will be very useful. hope to hear from you guys as soon as possible. Thank you once again

Regrads,
-=FYProject=-