# Replaceable Map MCs?

**URL:** <https://forum.kirupa.com/t/replaceable-map-mcs/280373>\
**Category:** programming\
**Created:** [January 26, 2009, 9:27pm UTC](https://forum.kirupa.com/t/replaceable-map-mcs/280373 "2009-01-26T21:27:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [January 26, 2009, 9:27pm UTC](https://forum.kirupa.com/t/replaceable-map-mcs/280373/1 "2009-01-26T21:27:12Z")

</div>

Hey all, I’m trying to make a replaceable map system for my rpg so that the code could come out cleaner. So far, I’m having no luck with my current code:

```auto

function boundPlayer(mapHolder:MovieClip, playerShell:MovieClip) {
     if (_root.playerShell.hitTest(_root.boundLeft)) {
        _root.mapHolder._x += mapSpeed;
        _root.playesce("Hit Left");
    }
}

```

See, I’m going to have different maps on each frame but they are all going to have the same codes (scrolling, hittest etc.) so I don’t want to have to type in the same code in each and every frame. So I figured, if I could just make one function and just replace the code’s target, it’ll be a whole lot cleaner. I’m not exactly sure how to do this other then have tons of variables. Is there any other way?

-Jephz
