<commit_before>//
//  ScrollingBackground.swift
//  SpriteKittDemo
//
//  Created by MariaSaveleva on 25/12/2016.
//  Copyright © 2016 MariaSaveleva. All rights reserved.
//

import Foundation
import SpriteKit

class ScrollingBackground: SKSpriteNode {

    public var velocity: CGFloat = 10.0
    public var backgroundImageName = ""

    private var firstNode: SKSpriteNode?
    private var secondNode: SKSpriteNode?

    public func configureScrollingBackground() {
        firstNode = SKSpriteNode(imageNamed: backgroundImageName)

        guard let firstNode = self.firstNode else { return }

        firstNode.anchorPoint = CGPoint.zero
        firstNode.position = self.position
        self.addChild(firstNode)
    }

    public func update(currentTime: TimeInterval) {
        //todo: apply for all child nodes
        guard let firstNode = self.firstNode else { return }

        firstNode.position = CGPoint(x: firstNode.position.x - self.velocity, y: firstNode.position.y)
    }

}<commit_msg>WIP: second node<commit_after>//
//  ScrollingBackground.swift
//  SpriteKittDemo
//
//  Created by MariaSaveleva on 25/12/2016.
//  Copyright © 2016 MariaSaveleva. All rights reserved.
//

import Foundation
import SpriteKit

class ScrollingBackground: SKSpriteNode {

    public var velocity: CGFloat = 10.0
    public var backgroundImageName = ""

    private var firstNode: SKSpriteNode?
    private var secondNode: SKSpriteNode?

    public func configureScrollingBackground() {
        firstNode = SKSpriteNode(color: .green, size: size)
        secondNode = SKSpriteNode(color: .red, size: size)

        guard let firstNode = self.firstNode,
            let secondNode = self.secondNode else { return }

        firstNode.anchorPoint = CGPoint.zero
        firstNode.position = CGPoint(x: -self.size.width/2, y: -self.size.height/2)
        addChild(firstNode)

        secondNode.anchorPoint = CGPoint.zero
        secondNode.position = CGPoint(x: -self.size.width/2 + secondNode.size.width, y: -self.size.height/2)
        addChild(secondNode)
    }

    public func update(currentTime: TimeInterval) {
        guard let firstNode = self.firstNode,
            let secondNode = self.secondNode else { return }

        firstNode.position = CGPoint(x: firstNode.position.x - self.velocity, y: firstNode.position.y)
        secondNode.position = CGPoint(x: secondNode.position.x - self.velocity, y: secondNode.position.y)

        //todo: add point check for firstNode
    }

}
{'fraction_non_alphanumeric': 0.09244372990353698, 'fraction_numerical': 0.013665594855305467, 'mean_word_length': 2.9135220125786163, 'pattern_counts': {'":': 0, '<': 3, '<?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': '237558', 'n_tokens_mistral': 768, 'n_tokens_neox': 729, 'n_words': 187}