# Help tweek my parallax code?

**URL:** https://forum.kirupa.com/t/help-tweek-my-parallax-code/310620
**Category:** Uncategorized
**Created:** [June 15, 2010, 6:43am UTC](https://forum.kirupa.com/t/help-tweek-my-parallax-code/310620 "2010-06-15T06:43:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dtrace](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dtrace](https://forum.kirupa.com/u/dtrace)
#### Post date: [June 15, 2010, 6:43am UTC](https://forum.kirupa.com/t/help-tweek-my-parallax-code/310620/1 "2010-06-15T06:43:37Z")

</div>

I am trying to do a slight parallax effect. Right now, the code i’m using takes my object from the far left of the screen, to the far right. I only want it to move like 200 pixels away from the center of the screen.

How can I tweek this code in order to achieve this?

Thanks.

onClipEvent (enterFrame) {  
if (\_root.mainVarX == 0) {  
// horizontale position  
homeX = (-\_root.\_xmouse\*1+1100);

```
} else {
	
	homeX = (-_root.mainVarX +1100);
	
}
thisX = _x;

diffX = homeX-thisX;

if (_root.mainVarX == 0) {
	moveX = diffX/5;
	
} else {
	moveX = diffX/5;
	
}

	_x = thisX+moveX;

```

}
