-
How to move MC with setting a boundaries?
Hi,
I have the following code that allow me to move MC with the keyboards.
How i can set the boundaries not as a stage? what i'm trying to do is to move my character just a little.
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
if(this._y > 0){
this._y -= 5;
}
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN)) {
if(this._y < Stage.height){
this._y += 7;
}
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
if(this._x > 0){
this._x -= 7;
}
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if(this._x < Stage.width){
this._x += 7;
}
}
}
Thanks a lot!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|