<commit_before>Crafty.c 'ScrollWall',
  init: ->
    @requires('2D, Canvas, Color, Edge, Collision')
    @attr
      x: 0
      y: 0
      w: 2
      h: Crafty.viewport.height
      speed:
        x: 0
        y: 0

    @_speed = { x: 0, y: 0 }
    @wallEnd = Crafty.e('2D, Canvas, Color, ScrollFront')
      .attr(x: - (Crafty.viewport.x - Crafty.viewport.width) - 3, y: 0, h: Crafty.viewport.height, w: 2)
    @attach @wallEnd

    @wallTop = Crafty.e('2D, Canvas, Edge, Collision')
      .attr(x: 0, y: 40, h: 2, w: Crafty.viewport.width)
    @attach @wallTop

    @wallBottom = Crafty.e('2D, Canvas, Edge, Collision')
      .attr(x: 0, y: Crafty.viewport.height - 2, h: 2, w: Crafty.viewport.width)
    @attach @wallBottom

    @bind 'EnterFrame', ->
      speedX = @_speed.x
      speedY = @_speed.y

      # When the ships are in the first 30% of the screen,
      # speed up the camera.
      Crafty('PlayerControlledShip').each ->
        margin = Crafty.viewport.width / 3.0
        if @x >  (- (Crafty.viewport.x - Crafty.viewport.width)) - margin
          if speedX > 0
            perc = (speedX + 2) / speedX
            speedY *= perc
          speedX += 2

      @x += speedX
      @y += speedY

      Crafty.viewport.scroll('_y', -@y)
      Crafty.viewport.scroll('_x', -@x)
      #Crafty.viewport._clamp() # TODO: Figure out what this does and if we need it

    @onHit 'PlayerControlledShip', (el) ->
      # Push the player forward
      for e in el
        p = e.obj
        p.attr x: p.x + @_speed.x
<commit_msg>Cleanup<commit_after>Crafty.c 'ScrollWall',
  init: ->
    @requires('2D, Canvas, Color, Edge, Collision')
    @attr
      x: 0
      y: 0
      w: 2
      h: Crafty.viewport.height
      speed:
        x: 0
        y: 0

    @_speed = { x: 0, y: 0 }
    @wallEnd = Crafty.e('2D, Canvas, Color, ScrollFront')
      .attr(x: - (Crafty.viewport.x - Crafty.viewport.width) - 3, y: 0, h: Crafty.viewport.height, w: 2)
    @attach @wallEnd

    @wallTop = Crafty.e('2D, Canvas, Edge, Collision')
      .attr(x: 0, y: 40, h: 2, w: Crafty.viewport.width)
    @attach @wallTop

    @wallBottom = Crafty.e('2D, Canvas, Edge, Collision')
      .attr(x: 0, y: Crafty.viewport.height - 2, h: 2, w: Crafty.viewport.width)
    @attach @wallBottom

    @bind 'EnterFrame', ->
      speedX = @_speed.x
      speedY = @_speed.y

      # When the ships are in the first 30% of the screen,
      # speed up the camera.
      Crafty('PlayerControlledShip').each ->
        margin = Crafty.viewport.width / 3.0
        if @x >  (- (Crafty.viewport.x - Crafty.viewport.width)) - margin
          if speedX > 0
            perc = (speedX + 2) / speedX
            speedY *= perc
          speedX += 2

      @x += speedX
      @y += speedY

      Crafty.viewport.y = -@y
      Crafty.viewport.x = -@x
      Crafty.viewport._clamp() # TODO: Figure out what this does and if we need it

    @onHit 'PlayerControlledShip', (el) ->
      # Push the player forward
      for e in el
        p = e.obj
        p.attr x: p.x + @_speed.x

{'fraction_non_alphanumeric': 0.1417296941795462, 'fraction_numerical': 0.018414995067412034, 'mean_word_length': 1.956268221574344, 'pattern_counts': {'":': 0, '<': 3, '<?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': '918761', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1112, 'n_words': 306}