;

PDA

Click to See Complete Forum and Search --> : Action Script Help


-Mystikal
09-11-2005, 09:29 PM
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:

FLASHPULSE
09-11-2005, 10:08 PM
http://www.flashkit.com/board/showthread.php?t=566528&highlight=arrow+keys

-Mystikal
09-12-2005, 04:18 PM
Thanks dude :thumbsup: :D

Ultra Pulse
09-12-2005, 04:19 PM
http://www.flashkit.com/board/showthread.php?t=566528&highlight=arrow+keys

Nice use of links, you have to click the link to click another link!


BTW you can use the hittest function.


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 :

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.

-Mystikal
09-12-2005, 05:26 PM
Thanks both pulses.