<commit_before>import * as _ from 'lodash';
import * as pag from 'pag';
import * as ppe from 'ppe';
import * as sss from 'sss';
import * as ob from './ob/index';

ob.init(init, initGame, update);
let p: p5 = ob.p;
let m = ob.m;

function init() {
  ob.screen.init(128, 128);
  ob.setTitle('ONE BUTTON', 'FOR ALL');
  //ob.setReplayFuncs(generateActor, getReplayStatus, setReplayStatus);
  //ob.setSeeds(0);
  ob.enableDebug(() => {
  });
  pag.setDefaultOptions({
    isLimitingColors: true
  });
  ppe.setOptions({
    isLimitingColors: true
  });
}

function initGame() {
  _.times(64, () => new m.Actor.Star());
  new Player();
  ob.addModule(new m.DoInterval(null, () => {
    new Enemy();
  }, 60, false, true));
}

function update() {
}

class Player extends m.Actor.Player {
  ms;
  nextAsAngle = p.HALF_PI;

  constructor() {
    super();
    this.ms = new m.MoveSin(this, 'pos.x');
    this.addModule(this.ms);
    this.pos.y = 100;
    this.angle = -p.HALF_PI;
  }

  update() {
    this.ms.speed = ob.ui.isPressed ? 0.1 : 0.03;
    if (this.ms.angle >= this.nextAsAngle) {
      ob.addScore(1, this.pos);
      this.nextAsAngle += p.PI;
      sss.play('c1');
    }
    super.update();
  }
}

class Enemy extends m.Actor.Enemy {
  constructor() {
    super();
    this.pos.x = p.random(128);
    this.vel.y = p.random(1, m.getDifficulty());
    this.addModule(new m.RemoveWhenOut(this))
    this.angle = p.HALF_PI;
  }
}<commit_msg>Add Shot<commit_after>import * as _ from 'lodash';
import * as pag from 'pag';
import * as ppe from 'ppe';
import * as sss from 'sss';
import * as ob from './ob/index';

ob.init(init, initGame, update);
let p: p5 = ob.p;

function init() {
  ob.screen.init(128, 128);
  ob.setTitle('ONE BUTTON', 'FOR ALL');
  //ob.setReplayFuncs(generateActor, getReplayStatus, setReplayStatus);
  //ob.setSeeds(0);
  ob.enableDebug(() => {
  });
  pag.setDefaultOptions({
    isLimitingColors: true
  });
  ppe.setOptions({
    isLimitingColors: true
  });
}

function initGame() {
  _.times(64, () => new ob.Star());
  new Player();
  ob.addModule(new ob.DoInterval(null, () => {
    new Enemy();
  }, 60, false, true));
}

function update() {
}

class Player extends ob.Player {
  ms;
  nextAsAngle = p.HALF_PI;

  constructor() {
    super();
    this.ms = new ob.MoveSin(this, 'pos.x');
    this.addModule(this.ms);
    this.pos.y = 100;
    this.angle = -p.HALF_PI;
  }

  update() {
    this.ms.speed = ob.ui.isPressed ? 0.1 : 0.03;
    if (this.ms.angle >= this.nextAsAngle) {
      ob.addScore(1, this.pos);
      this.nextAsAngle += p.PI;
      sss.play('c1');
    }
    if (ob.ui.isJustPressed) {
      new ob.Shot(this);
    }
    super.update();
  }
}

class Enemy extends ob.Enemy {
  constructor() {
    super();
    this.pos.x = p.random(128);
    this.vel.y = p.random(1, ob.getDifficulty());
    this.angle = p.HALF_PI;
  }
}
{'fraction_non_alphanumeric': 0.18194492854653188, 'fraction_numerical': 0.01812478215406065, 'mean_word_length': 2.873144399460189, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1719405', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1125, 'n_words': 232}