<commit_before>//
//  GameScene.swift
//  LD33
//
//  Created by <NAME> on 8/22/15.
//  Copyright (c) 2015 MikeDave. All rights reserved.
//

import SpriteKit

struct PhysicsCategory {
    static let None     : UInt32 = 0
    static let All      : UInt32 = UInt32.max
    static let Player   : UInt32 = 0b1      // 1
    static let Enemy    : UInt32 = 0b10     // 2
    static let Bullet   : UInt32 = 0b100    // 4
    static let Powerup  : UInt32 = 0b1000   // 8
}

let playerCategory: UInt32 = 0x1 << 0
let enemyCategory: UInt32 = 0x1 << 1
let bulletCategory: UInt32 = 0x1 << 2

class GameScene: SKScene {
    
    let playerMovePointsPerSec: CGFloat = 1000.0
    var lastUpdateTime: NSTimeInterval = 0
    var dt: NSTimeInterval = 0
    var velocity = CGPointZero
    var lastTouchLocation: CGPoint?
    
    var player: Player!
    var moveBulletAction: SKAction!
    
    var score: Int = 0 {
        willSet {
            if score / 1000 < newValue / 1000 {
                // drop a free powerup for every 100 points earned
                dropPowerup()
            }
        }
        didSet {
            scoreLabel.text = String(format: "Score: %06d", score)
        }
    }
    var scoreLabel: SKLabelNode = SKLabelNode(text: "")
    
    override func didMoveToView(view: SKView) {
        /* Setup your scene here */

        
        player = Player()
        player.position = CGPoint(x: 200, y: size.height / 2)
        addChild(player)
        player.startShooting()
        
        let enemyString = SKAction.repeatAction(SKAction.sequence([
            SKAction.runBlock { [weak self] in Enemy(type: .A).attackOn(self) },
            SKAction.waitForDuration(0.5)
        ]), count: 5)
        
        runAction(SKAction.repeatActionForever(SKAction.sequence([
            enemyString,
            SKAction.waitForDuration(5)
        ])))
        
        physicsWorld.contactDelegate = self
        
        score = 0
        addChild(scoreLabel)
        scoreLabel.fontColor = SKColor.whiteColor()
        scoreLabel.horizontalAlignmentMode = .Right
        scoreLabel.position = CGPoint(x: size.width - 20, y: size.height - scoreLabel.frame.size.height - 110)
     
        
        runAction(SKAction.repeatActionForever(SKAction.sequence([
            SKAction.playSoundFileNamed("Invader.mp3", waitForCompletion: true),
            SKAction.waitForDuration(10)
        ])))
        
    }
    
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        sceneTouched(touches.first)
    }<commit_msg>delay start for music intro<commit_after>//
//  GameScene.swift
//  LD33
//
//  Created by <NAME> on 8/22/15.
//  Copyright (c) 2015 MikeDave. All rights reserved.
//

import SpriteKit

struct PhysicsCategory {
    static let None     : UInt32 = 0
    static let All      : UInt32 = UInt32.max
    static let Player   : UInt32 = 0b1      // 1
    static let Enemy    : UInt32 = 0b10     // 2
    static let Bullet   : UInt32 = 0b100    // 4
    static let Powerup  : UInt32 = 0b1000   // 8
}

let playerCategory: UInt32 = 0x1 << 0
let enemyCategory: UInt32 = 0x1 << 1
let bulletCategory: UInt32 = 0x1 << 2

class GameScene: SKScene {
    
    let playerMovePointsPerSec: CGFloat = 1000.0
    var lastUpdateTime: NSTimeInterval = 0
    var dt: NSTimeInterval = 0
    var velocity = CGPointZero
    var lastTouchLocation: CGPoint?
    
    var player: Player!
    var moveBulletAction: SKAction!
    
    var score: Int = 0 {
        willSet {
            if score / 1000 < newValue / 1000 {
                // drop a free powerup for every 100 points earned
                dropPowerup()
            }
        }
        didSet {
            scoreLabel.text = String(format: "Score: %06d", score)
        }
    }
    var scoreLabel: SKLabelNode = SKLabelNode(text: "")
    
    override func didMoveToView(view: SKView) {
        /* Setup your scene here */

        
        player = Player()
        player.position = CGPoint(x: 200, y: size.height / 2)
        addChild(player)
        player.startShooting()
        
        let enemyString = SKAction.repeatAction(SKAction.sequence([
            SKAction.runBlock { [weak self] in Enemy(type: .A).attackOn(self) },
            SKAction.waitForDuration(0.5)
        ]), count: 5)
        
        let keepEmComing = SKAction.repeatActionForever(SKAction.sequence([
            enemyString,
            SKAction.waitForDuration(5)
        ]))
        
        runAction(SKAction.sequence([
            SKAction.waitForDuration(15),
            keepEmComing
        ]))
        
        physicsWorld.contactDelegate = self
        
        score = 0
        addChild(scoreLabel)
        scoreLabel.fontColor = SKColor.whiteColor()
        scoreLabel.horizontalAlignmentMode = .Right
        scoreLabel.position = CGPoint(x: size.width - 20, y: size.height - scoreLabel.frame.size.height - 110)
     
        
        runAction(SKAction.repeatActionForever(SKAction.sequence([
            SKAction.playSoundFileNamed("Invader.mp3", waitForCompletion: true),
            SKAction.waitForDuration(10)
        ])))
        
    }
    
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        sceneTouched(touches.first)
    }
{'fraction_non_alphanumeric': 0.09426073736221968, 'fraction_numerical': 0.03724819460281262, 'mean_word_length': 1.945159485170677, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6506537', 'n_tokens_mistral': 1752, 'n_tokens_neox': 1573, 'n_words': 385}