<commit_before>var Enemy = function(game, key ,enemyHP) {
  //Call constructor of Phaser.Sprite to initialize this
  Phaser.Sprite.call(this, game, 0, 0, key);

  //Set the origin point of the sprite to its center
  this.anchor.set(0.5);
  this.checkWorldBounds = true;
  this.outOfBoundsKill = true;
  //Record whether sprite is processed by the update() function
  this.exists = false;
  this.Hp = enemyHP;

}
//Enemy inherited from Phaser.sprite
Enemy.prototype = Object.create(Phaser.Sprite.prototype);
Enemy.prototype.constructor = Enemy;

Enemy.prototype.launch = function(x, y, angle, speed, xAccel) {
  //horizontal acceleration value
  xAccel = xAccel || 0;

  //Reset the Enemy, which moves the Enemy to the given x/y corrdinates and
  //sets 'exists' to true.
  this.reset(x, y);

  //Set Enemy's velocity that is calculated from the given angle and speed
  this.game.physics.arcade.velocityFromAngle(angle, speed, this.body.velocity);
  this.body.acceleration.x = xAccel;
}

Enemy.prototype.isDead = function(bullet, enemy)
{
  bullet.kill();
  enemy.Hp -= bullet.damage;
  if(enemy.Hp <= 0)
  {
    enemy.Hp = game.rnd.between(2,3);
    return true;
  }
  else {
    return false;
  }
}
<commit_msg>Add enemy level<commit_after>var Enemy = function(game, key , health , level) {
  //Call constructor of Phaser.Sprite to initialize this
  //alert(level)
  Phaser.Sprite.call(this, game, 0, 0, key);

  //Set the origin point of the sprite to its center
  this.anchor.set(0.5);
  this.checkWorldBounds = true;
  this.outOfBoundsKill = true;
  //Record whether sprite is processed by the update() function
  this.exists = false;
  this.maxHealth = health;
  this.currentHealth = health;
  //Enemy Level
  this.eneLevel = level;
}
//Enemy inherited from Phaser.sprite
Enemy.prototype = Object.create(Phaser.Sprite.prototype);
Enemy.prototype.constructor = Enemy;

Enemy.prototype.launch = function(x, y, angle, speed, xAccel) {
  //horizontal acceleration value
  xAccel = xAccel || 0;

  //Reset the Enemy, which moves the Enemy to the given x/y corrdinates and
  //sets 'exists' to true.
  this.reset(x, y);

  //Set Enemy's velocity that is calculated from the given angle and speed
  this.game.physics.arcade.velocityFromAngle(angle, speed, this.body.velocity);
  this.body.acceleration.x = xAccel;
}

Enemy.prototype.resetHealth = function() {
  this.currentHealth = this.maxHealth;
}

Enemy.prototype.isDead = function(bullet, enemy)
{
  enemy.currentHealth -= bullet.damage;
  bullet.kill();
  if(enemy.currentHealth <= 0)
  {
    enemy.resetHealth();
    return true;
  }
  else {
    return false;
  }
}


{'fraction_non_alphanumeric': 0.11971025543271063, 'fraction_numerical': 0.00533739992375143, 'mean_word_length': 3.619718309859155, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6904211', 'n_tokens_mistral': 905, 'n_tokens_neox': 879, 'n_words': 245}