<commit_before>var _ = require('lodash')
var Entity = require('crtrdg-entity')
var Freemove = require('../movement/freemove.js')
var inherits = require('inherits')
var point = require('../geometry/point.js')

module.exports = Player
inherits(Player, Entity)

function Player (opts) {
  this.opts = opts || {}
  this.geometry = point({
    id: 'player',
    type: 'player',
    props: {moveable: true}
  })
  this.movement = new Freemove({
    keymap: ['<left>', '<right>', '<up>', '<down>'],
    translation: [[0, 0, 0, 0], [0, 0, 1, -1]],
    rotation: [-1, 1, 0, 0]
  })
}

Player.prototype.move = function (keys) {
  var rotation = this.geometry.transform.rotation
  var delta = this.movement.compute(keys, rotation)
  this.geometry.update(delta)
}

Player.prototype.moveto = function (delta) {
  this.geometry.update(delta)<commit_msg>threshold movement events<commit_after>var _ = require('lodash')
var Entity = require('crtrdg-entity')
var Freemove = require('../movement/freemove.js')
var inherits = require('inherits')
var point = require('../geometry/point.js')

module.exports = Player
inherits(Player, Entity)

function Player (opts) {
  this.opts = opts || {}
  this.geometry = point({
    id: 'player',
    type: 'player',
    props: {moveable: true}
  })
  this.movement = new Freemove({
    keymap: ['<left>', '<right>', '<up>', '<down>'],
    translation: [[0, 0, 0, 0], [0, 0, 1, -1]],
    rotation: [-1, 1, 0, 0]
  })
}

Player.prototype.move = function (keys) {
  var rotation = this.geometry.transform.rotation
  var delta = this.movement.compute(keys, rotation)
  this.geometry.update(delta)
  var cond1 = Math.abs(delta.translation[0]) > 0.0000001
  var cond2 = Math.abs(delta.translation[1]) > 0.0000001
  var cond3 = Math.abs(delta.rotation) > 0.0000001
  var cond4 = Math.abs(delta.scale - 1) > 0.0000001
  return (cond1 || cond2 || cond3 || cond4)
}

Player.prototype.moveto = function (delta) {
  this.geometry.update(delta)
{'fraction_non_alphanumeric': 0.17990773962070733, 'fraction_numerical': 0.03434136340338288, 'mean_word_length': 3.954314720812183, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '2174627', 'n_tokens_mistral': 718, 'n_tokens_neox': 677, 'n_words': 161}