<commit_before>var Engine = Matter.Engine,
    World = Matter.World,
    Bodies = Matter.Bodies;

// create a Matter.js engine
var engine = Engine.create({
  render: {
    element: document.body,
    canvas: document.getElementById("playingField")
  }
});
engine.render.options.wireframes = false;
engine.render.options.background = "#007500";
engine.render.canvas.width = 1920;
engine.render.canvas.height = 1080;
engine.world.gravity.y = 0;


var circle = Bodies.circle(450,300,20,{
  restitution: 0.4,
  mass: 10,
  intertia: Number.POSITIVE_INFINITY,
  render: {
    fillStyle: "red",
    strokeStyle: "black",
    lineWidth: 4
  }
});

var circle2 = Bodies.circle(500,250,20,{
  restitution: 0.4,
  render: {
    fillStyle: "blue",
    strokeStyle: "black",
    lineWidth: 4
  }
});

var ball = Bodies.circle(700,500,15,{
  restitution: 0.4,
  render: {
    fillStyle: "white",
    strokeStyle: "black",
    lineWidth: 4
  }
});

Matter.Body.applyForce(circle, circle.position, Matter.Vector.create(0.01, 0.01));

var ground = Bodies.rectangle(400, 610, 810, 60, { isStatic: true });

// add all of the bodies to the world
World.add(engine.world, [circle, circle2, ball, ground]);

// run the engine
Engine.run(engine);

function update() {
  var gamepads = navigator.getGamepads();
  var pad = gamepads[0]
  if (pad !== undefined) {
    var x = pad.axes[0];
    var y = pad.axes[1];
    var vect = Matter.Vector.create(x,y);
    if (Matter.Vector.magnitude(vect) > 0.1) {
      console.log(vect);
      Matter.Body.applyForce(circle, circle.position, Matter.Vector.mult(vect,0.01));
    }
    Bodies

  }
  requestAnimationFrame(update);
}

requestAnimationFrame(update);
<commit_msg>start on playingfield<commit_after>var Engine = Matter.Engine,
    World = Matter.World,
    Bodies = Matter.Bodies;

// create a Matter.js engine
var engine = Engine.create({
  render: {
    element: document.body,
    canvas: document.getElementById("playingField")
  }
});

engine.render.options.wireframes = true;
engine.render.options.background = "#007500";
engine.render.canvas.width = 1920;
engine.render.canvas.height = 1080;
engine.world.gravity.y = 0;


// CATEGORIES:
var CAT_BALL = 1;
var CAT_PLAYER = 2;
var CAT_RESTRICT_BALL = 4;

// init game field
World.add(engine.world, [
  Bodies.rectangle(1920/2, 10, 1920, 20, { isStatic: true }),
  Bodies.rectangle(1920/2, 1070, 1920, 20, { isStatic: true }),
  Bodies.rectangle(10, 1080/2, 20, 1080, { isStatic: true }),
  Bodies.rectangle(1910, 1080/2, 20, 1080, { isStatic: true }),
  Bodies.rectangle(1920/2, 50, 1920, 100, {
    isStatic: true,
    collisionFilter: {
      category: CAT_RESTRICT_BALL,
      mask: CAT_BALL
    },
    render: {
      visible: engine.render.options.wireframes
    }
  }),
  Bodies.rectangle(1920/2, 1030, 1920, 100, {
    isStatic: true,
    collisionFilter: {
      category: CAT_RESTRICT_BALL,
      mask: CAT_BALL
    },
    render: {
      visible: engine.render.options.wireframes
    }
  }),
  Bodies.rectangle(50, 1080/2, 100, 1080, {
    isStatic: true,
    collisionFilter: {
      category: CAT_RESTRICT_BALL,
      mask: CAT_BALL
    },
    render: {
      visible: engine.render.options.wireframes
    }
  }),
  Bodies.rectangle(1870, 1080/2, 100, 1080, {
    isStatic: true,
    collisionFilter: {
      category: CAT_RESTRICT_BALL,
      mask: CAT_BALL
    },
    render: {
      visible: engine.render.options.wireframes
    }
  })
]);

var ball = Bodies.circle(700,500,15,{
  restitution: 0.4,
  intertia: Number.POSITIVE_INFINITY,
  collisionFilter: {
    category: CAT_BALL,
    mask: CAT_PLAYER | CAT_RESTRICT_BALL
  },
  render: {
    fillStyle: "white",
    strokeStyle: "black",
    lineWidth: 4
  }
});

var circle = Bodies.circle(450,300,20,{
  restitution: 0.4,
  mass: 10,
  frictionAir: 0.1,
  intertia: Number.POSITIVE_INFINITY,
  render: {
    fillStyle: "red",
    strokeStyle: "black",
    lineWidth: 4
  },
  collisionFilter: {
    category: CAT_PLAYER,
    mask: CAT_BALL | CAT_PLAYER
  }
});

var circle2 = Bodies.circle(500,250,20,{
  restitution: 0.4,
  mass: 10,
  frictionAir: 0.1,
  intertia: Number.POSITIVE_INFINITY,
  render: {
    fillStyle: "blue",
    strokeStyle: "black",
    lineWidth: 4
  },
  collisionFilter: {
    category: CAT_PLAYER,
    mask: CAT_BALL | CAT_PLAYER
  }
});

// add all of the bodies to the world
World.add(engine.world, [circle, circle2, ball]);



// run the engine
Engine.run(engine);

function update() {
  var gamepads = navigator.getGamepads();
  var pad = gamepads[0]
  if (pad !== undefined) {
    var x = pad.axes[0];
    var y = pad.axes[1];
    var vect = Matter.Vector.create(x,y);
    if (Matter.Vector.magnitude(vect) > 0.1) {
      Matter.Body.applyForce(circle, circle.position, Matter.Vector.mult(vect,0.01));
    }
    if (pad.buttons[0].pressed) {
      circle.render.strokeStyle = "white";
    }
    else {
      circle.render.strokeStyle = "black";
    }
  }
  requestAnimationFrame(update);
}

requestAnimationFrame(update);

{'fraction_non_alphanumeric': 0.14354258296681327, 'fraction_numerical': 0.052578968412634944, 'mean_word_length': 3.2362404741744286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5230162', 'n_tokens_mistral': 2051, 'n_tokens_neox': 1808, 'n_words': 372}