# Help Character Movement

**URL:** <https://forum.kirupa.com/t/help-character-movement/307161>\
**Category:** flash\
**Created:** [March 29, 2010, 9:47pm UTC](https://forum.kirupa.com/t/help-character-movement/307161 "2010-03-29T21:47:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xela159](https://avatars.discourse-cdn.com/v4/letter/x/77aa72/32.png) [@xela159](https://forum.kirupa.com/u/xela159)\
**Post date:** [March 29, 2010, 9:47pm UTC](https://forum.kirupa.com/t/help-character-movement/307161/1 "2010-03-29T21:47:12Z")

</div>

I’m making a simple game where the player uses ASDW to move a guy around the screen. The jumping works like i want it to. My left and right movement used to work, but now they don’t. Originally I had a layer for my actor and an instance of him on the screen. (My actor is a 5 frame loop of someone running; the first frame also contains variables like run speed, and jump velocity.) I now create my character my making a new movie clip adding an instance of my char to that movie clip then adding the movie clip to the stage.

The character sprites I’m using are from Mario games.

```auto

var mario:Mario = new Mario();
var mario_mc:MovieClip = new MovieClip;
mario_mc.addChild(mario);
stage.addChild(mario_mc);
mario_mc.x = 275;
mario_mc.y = 200;

```

The problem I’m encountering is when i try to move my movieClip left or right it warps to the left most edge of the screen. I did trace testing and i know it is setting the mario\_mc.x to 0.

I use booleans to manage my X movement. On key press the boolean turns true on release it turns false. The frame is looped and when i enter the frame i update the X and Y positions of the movie clip.

```auto

        if (mario_mc.left) {
		mario_mc.play();
		if (mario_mc.x>leftBound) {
			mario_mc.x-=mario_mc.runSpeed;
		} else {
			mario_mc.x+=mario_mc.runSpeed * 2;
		}
	}
	if (mario_mc.right) {
		mario_mc.play();
		if (mario_mc.x<rightBound) {
			mario_mc.x+=mario_mc.runSpeed;
		} else {
			mario_mc.x-=mario_mc.runSpeed * 2;
		}
	}

```

I don’t think the problem is with the movement code but with the way i created my character. Any help/advice would be greatly appreciated.
