<commit_before>var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render })
  , player
  , currentSpeed = 0
  , maximumSpeed = 200;


function preload() {
  game.load.image('arrow', 'assets/arrow.png');
}

function create() {
  // Use Arcade physics
  game.physics.startSystem(Phaser.Physics.ARCADE);
  
  // Add the player sprite to the game, set the anchor point at its center
  player = game.add.sprite(400, 300, 'arrow');
  player.anchor.setTo(0.5, 0.5);

  // Enable physics on the player
  game.physics.enable(player, Phaser.Physics.ARCADE);
}

function update() {
  // Reset the player's velocities
  player.body.velocity.x = 0;
  player.body.velocity.y = 0;
  player.body.angularVelocity = 0;

  // Apply an angular velocity (turning the player) when pressing 'A'or 'D'
  if(game.input.keyboard.isDown(Phaser.Keyboard.A)) {
    player.body.angularVelocity = -200;
  }
  else if(game.input.keyboard.isDown(Phaser.Keyboard.D)) {
    player.body.angularVelocity = 200;
  }

  // Accelerate up to a max speed while holding down 'W', deccelerate when
  // not pressed
  if(game.input.keyboard.isDown(Phaser.Keyboard.W)) {
    if(currentSpeed < maximumSpeed) {
      currentSpeed += 5;
    }
  }
  else {
    if(currentSpeed > 0) {
      currentSpeed -= 3;
    }
  }

  // Apply velocity based on the current angle when moving forward
  game.physics.arcade.velocityFromAngle(player.angle, currentSpeed, player.body.velocity);

  // Make the player wrap around the screen
  if(player.body.x < 0) {
    player.body.x = 800;
  }
  else if(player.body.x > 800) {
    player.body.x = 0;
  }
<commit_msg>fix: Prevent player from drifting backwards after stop<commit_after>var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render })
  , player
  , currentSpeed = 0
  , maximumSpeed = 200;


function preload() {
  game.load.image('arrow', 'assets/arrow.png');
}

function create() {
  // Use Arcade physics
  game.physics.startSystem(Phaser.Physics.ARCADE);
  
  // Add the player sprite to the game, set the anchor point at its center
  player = game.add.sprite(400, 300, 'arrow');
  player.anchor.setTo(0.5, 0.5);

  // Enable physics on the player
  game.physics.enable(player, Phaser.Physics.ARCADE);
}

function update() {
  // Reset the player's velocities
  player.body.velocity.x = 0;
  player.body.velocity.y = 0;
  player.body.angularVelocity = 0;

  // Apply an angular velocity (turning the player) when pressing 'A'or 'D'
  if(game.input.keyboard.isDown(Phaser.Keyboard.A)) {
    player.body.angularVelocity = -200;
  }
  else if(game.input.keyboard.isDown(Phaser.Keyboard.D)) {
    player.body.angularVelocity = 200;
  }

  // Accelerate up to a max speed while holding down 'W', deccelerate when
  // not pressed
  if(game.input.keyboard.isDown(Phaser.Keyboard.W)) {
    if(currentSpeed < maximumSpeed) {
      currentSpeed += 5;
    }
  }
  else {
    if(currentSpeed > 0) {
      currentSpeed -= 3;
    }
    if(currentSpeed < 0) {
      currentSpeed = 0;
    }
  }

  // Apply velocity based on the current angle when moving forward
  game.physics.arcade.velocityFromAngle(player.angle, currentSpeed, player.body.velocity);

  // Make the player wrap around the screen
  if(player.body.x < 0) {
    player.body.x = 800;
  }
  else if(player.body.x > 800) {
    player.body.x = 0;
  }

{'fraction_non_alphanumeric': 0.1314252336448598, 'fraction_numerical': 0.02394859813084112, 'mean_word_length': 3.176829268292683, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, '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': '2681688', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1156, 'n_words': 289}