# Moveable boundries

**URL:** <https://forum.kirupa.com/t/moveable-boundries/12276>\
**Category:** Uncategorized\
**Created:** [January 29, 2003, 2:35am UTC](https://forum.kirupa.com/t/moveable-boundries/12276 "2003-01-29T02:35:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![korrupt](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@korrupt](https://forum.kirupa.com/u/korrupt)\
**Post date:** [January 29, 2003, 2:35am UTC](https://forum.kirupa.com/t/moveable-boundries/12276/1 "2003-01-29T02:35:20Z")

</div>

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:

```php

//
// 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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 29, 2003, 2:48am UTC](https://forum.kirupa.com/t/moveable-boundries/12276/2 "2003-01-29T02:48:38Z")

</div>

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:

```php

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 29, 2003, 2:57am UTC](https://forum.kirupa.com/t/moveable-boundries/12276/3 "2003-01-29T02:57:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 29, 2003, 2:59am UTC](https://forum.kirupa.com/t/moveable-boundries/12276/4 "2003-01-29T02:59:09Z")

</div>

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

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

?

Thanks again

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 29, 2003, 3:07am UTC](https://forum.kirupa.com/t/moveable-boundries/12276/5 "2003-01-29T03:07:01Z")

</div>

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

fmx:

```php

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

```

f5:

```php

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
