|
-
Action Script Help
Im creating a game, where you can move a person around on a tile map.
The problem is, the person can go off the screen (map). I need an action script where the person can't go off the map. (hits a border).
Thanks for the help, Tyler
-
Senior Member
-
Thanks
Thanks dude
-
Some dude, says hi
 Originally Posted by FLASHPULSE
Nice use of links, you have to click the link to click another link!
BTW you can use the hittest function.
Code:
onClipEvent(enterFrame){
if(this.hitTest(_root.wall)){ // if it hits an object with the instance name wall
this._y -= 1
}
}
or you can use this code :
Code:
onClipEvent (enterFrame){
if (this._x >= 550 //{ // width of movie
this._x = 549;
}
if (this._x >= 0 //{ // ther side of the width of movie
this._x = 1;
}
use the same code for up and down, I didn't test this code, but it should work,
and you place it on the movie clip that you are controlling.
Last edited by Ultra Pulse; 09-24-2005 at 04:30 PM.
Reason: BLAH
-
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
|