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 :cool:
Printable View
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 :cool:
Thanks dude :thumbsup: :D
Nice use of links, you have to click the link to click another link!Quote:
Originally Posted by FLASHPULSE
BTW you can use the hittest function.
or you can use this code :Code:onClipEvent(enterFrame){
if(this.hitTest(_root.wall)){ // if it hits an object with the instance name wall
this._y -= 1
}
}
use the same code for up and down, I didn't test this code, but it should work,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;
}
and you place it on the movie clip that you are controlling.
Thanks both pulses.