Moveable boundries

Ok, here’s the dilema…

I have a stick figure fighting game I’m currently working on. I’ve animated the moves and the walking, ect. But now I wanna make it so the players can only stand on one mc, GameArea.

I tried the script that came with part of the tutorial, but nothing happen:


//
// getBoundLeft(), getBoundRight(), getBoundTop(), getBoundBottom() returns bound
//
// returns the boundry to the game area
//
function getBoundLeft()
{
	return GameArea._x;
}

function getBoundRight()
{
	return GameArea._x+GameArea._width;
}

function getBoundTop()
{
	return GameArea._y;
}

function getBoundBottom()
{	
	return GameArea._y+GameArea._height;
}

If this way isn’t a possible, then I’d just like to limit the players on how high/low they can move.

Anyone with any insight would be GREATLY appreciated.

Thanks in advanced,
KoRRupt

[edit]Jubba: Just to make the code easier to read[/edit]

Those functions return a value. They aren’t supposed to limit anything. What you would do is call the variable in an IF statement check to see the position of the fighter:


if(fighter.MC._x >= GetBoundLeft()){
//do this...
}

Would I put that in the first frame of the maintimeline?

Also:

if(fighter.MC._x >= GetBoundLeft()){
//do this…
}

would fight.mc be the root and instance name?

_root.hero._x ?

Thanks man

-KoRRupt

Also how would i stop the hero mc (the main fighter)

if(fighter.MC._x >= GetBoundLeft()){
stop()
}

?

Thanks again

well it depends on if you are using FMX or F5.

fmx:


fightMC.onEnterFrame = function(){
     if(_x >= GetLeftBounds()){
          _x = ###
    }
}

f5:


onClipEvent(enterFrame){
     if(_x >= GetLeftBounds()){
          _x = ###
    }
}

just replace ### with the Xvalue that you want to place the FighterMC at. Do a seperate IF statement for every funciton