# Greating unbalanced

**URL:** https://forum.kirupa.com/t/greating-unbalanced/234964
**Category:** Uncategorized
**Created:** [August 7, 2007, 2:22pm UTC](https://forum.kirupa.com/t/greating-unbalanced/234964 "2007-08-07T14:22:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![stiffi](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@stiffi](https://forum.kirupa.com/u/stiffi)
#### Post date: [August 7, 2007, 2:22pm UTC](https://forum.kirupa.com/t/greating-unbalanced/234964/1 "2007-08-07T14:22:32Z")

</div>

Hi everyone

Im trying to create a game with a drunk effect where by the user controls an object along the x axis

the object of the game is to keep the object balanced as long as possible

how i aim to do this is increment and decrease the \_x axis randomly thus achieving the drunk effect and the user has to counter act the drunkness and keep the object as “stable” as possible

i found some code on another forum from a guy that was trying to do the same thing but it doesnt seem to work at all

```auto

onClipEvent (enterFrame) {
     mouse_x = _root._xmouse;
     circle_x= this._x;
     dist = mouse_x - circle_x;//if the xmouse position is greater than the
//circle's position dist will be a positive number, therefore the circle will move
//closer to the mouse (by moving right)
//if the xmouse position is less than the circle position dist will be a negative number, (by moving left)
          circle._x += (0.1 * dist);
}

```

when i applied this code it didnt do anything at all

any help on this would bereally appericated
