title: Matterjs Moving bodies using button click
body: <p>I am attempting to move a circle left and right. Below is the method that I tried. I get the result correct of x having the value of 600 but the circle doesn't change its position. Maybe it's related to the draw function because it's already been drawn?</p>
  <p>Can someone help me figure out what is wrong or is there a better way of moving the object from left to right using a button click?</p>
  <pre class="lang-js prettyprint-override"><code>function Particle(x, y, r) {
    this.hue = random(360);
    var options = {
      restitution: 0.8,
      friction: 0
    }
    x = 300;
    this.body = Bodies.circle(x, y, r, options);
    this.body.label = &quot;particle&quot;;
    this.r = r;
    World.add(world, this.body);
    $('#moveR').click(function() {
      for (i = x; i &lt;= WIDTH; i++) {
        x = i;
        console.log(x);
      }
    });
  </code></pre>