Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Orbit 7.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@
21100C321A6AE8270007CDB4 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastSwiftMigration = 0730;
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = Mav3r1ck;
TargetAttributes = {
21100C391A6AE8270007CDB4 = {
Expand Down Expand Up @@ -436,6 +438,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -502,6 +505,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = "Orbit 7/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Mav3r1ck.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 2;
};
Expand All @@ -514,6 +518,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = "Orbit 7/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Mav3r1ck.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 2;
};
Expand All @@ -533,6 +538,7 @@
);
INFOPLIST_FILE = "Orbit 7Tests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Mav3r1ck.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Orbit 7.app/Orbit 7";
};
Expand All @@ -548,6 +554,7 @@
);
INFOPLIST_FILE = "Orbit 7Tests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Mav3r1ck.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Orbit 7.app/Orbit 7";
};
Expand Down
11 changes: 6 additions & 5 deletions Orbit 7/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
Expand All @@ -12,13 +13,13 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Mav3r1ck. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="20.5"/>
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.60000002384185791" green="0.60000002384185791" blue="0.60000002384185791" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Orbit 7" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="143.5" width="441" height="36"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Orbit 7" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="144" width="441" height="36"/>
<fontDescription key="fontDescription" name="DINCondensed-Bold" family="DIN Condensed" pointSize="36"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
Expand Down
2 changes: 1 addition & 1 deletion Orbit 7/GameOver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GameOverScene: SKScene {

backgroundColor = SKColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1)

var message = won ? "You Won!" : "You Lost, Try again!"
let message = won ? "You Won!" : "You Lost, Try again!"

let label = SKLabelNode(fontNamed: "DIN Condensed")
label.text = message
Expand Down
56 changes: 32 additions & 24 deletions Orbit 7/GameScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ class GameScene: SKScene {

override func didMoveToView(view: SKView) {

var alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("Spiraling",ofType: "wav")!)

var error:NSError?
audioPlayerTwo = AVAudioPlayer(contentsOfURL: alertSound, error: &error)
audioPlayerTwo.prepareToPlay()
audioPlayerTwo.play()
audioPlayerTwo.numberOfLoops = -1
let alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("Spiraling",ofType: "wav")!)

do {
audioPlayerTwo = try AVAudioPlayer(contentsOfURL: alertSound)
audioPlayerTwo.prepareToPlay()
audioPlayerTwo.play()
audioPlayerTwo.numberOfLoops = -1
} catch let error1 as NSError {
print(error1)
}


// Set background Color
backgroundColor = SKColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1)
Expand Down Expand Up @@ -69,8 +73,8 @@ class GameScene: SKScene {

//Background Stars * * *
let stars = SKEmitterNode(fileNamed: "Stars")
stars.position = CGPointMake(400, 200)
addChild(stars)
stars!.position = CGPointMake(400, 200)
addChild(stars!)

//Func Add Squares
runAction(SKAction.repeatActionForever(SKAction.sequence([SKAction.runBlock(addNodeToScene),SKAction.waitForDuration(0.9)])
Expand Down Expand Up @@ -111,29 +115,33 @@ class GameScene: SKScene {


// Adding Touches
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {


let location = (touches.first as? UITouch)?.locationInNode(self)
let node = self.nodeAtPoint(location!)
let location = (touches.first! as UITouch).locationInNode(self)
let node = self.nodeAtPoint(location)

// Particles
func explosion() {
// Effects
let sparkEmmiter = SKEmitterNode(fileNamed: "ParticleFire.sks")
sparkEmmiter.name = "Fire"
sparkEmmiter.position = location!
sparkEmmiter.targetNode = self
sparkEmmiter.particleLifetime = 1
self.addChild(sparkEmmiter)
sparkEmmiter!.name = "Fire"
sparkEmmiter!.position = location
sparkEmmiter!.targetNode = self
sparkEmmiter!.particleLifetime = 1
self.addChild(sparkEmmiter!)

// Sounds
var alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("zapzap",ofType: "wav")!)
let alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("zapzap",ofType: "wav")!)

var error:NSError?
audioPlayer = AVAudioPlayer(contentsOfURL: alertSound, error: &error)
audioPlayer.prepareToPlay()
audioPlayer.play()
do {
audioPlayer = try AVAudioPlayer(contentsOfURL: alertSound)
audioPlayer.prepareToPlay()
audioPlayer.play()
} catch let error1 as NSError {
print(error1)
}


if (playerScore > gameObjective) {
let reveal = SKTransition.fadeWithDuration(0.5)
Expand Down Expand Up @@ -200,15 +208,15 @@ class GameScene: SKScene {

func showPauseAlert() {

var alert = UIAlertController(title: "\(gamelvlLable)", message: "Destroy the Asteroids! & Avoid the Satellites!", preferredStyle: UIAlertControllerStyle.Alert)
let alert = UIAlertController(title: "\(gamelvlLable)", message: "Destroy the Asteroids! & Avoid the Satellites!", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Continue", style: UIAlertActionStyle.Default) { _ in

})
self.view?.window?.rootViewController?.presentViewController(alert, animated: true, completion: nil)

}

override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
let dropDown = SKAction.scaleTo(1.0, duration: 0.2)
}

Expand Down
10 changes: 5 additions & 5 deletions Orbit 7/GameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import SpriteKit
extension SKNode {
class func unarchiveFromFile(file : NSString) -> SKNode? {
if let path = NSBundle.mainBundle().pathForResource(file as String, ofType: "sks") {
var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)!
var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)
let sceneData = try! NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe)
let archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)

archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as! Menu
Expand Down Expand Up @@ -52,11 +52,11 @@ class GameViewController: UIViewController {
return true
}

override func supportedInterfaceOrientations() -> Int {
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue)
return UIInterfaceOrientationMask.AllButUpsideDown
} else {
return Int(UIInterfaceOrientationMask.All.rawValue)
return UIInterfaceOrientationMask.All
}
}

Expand Down
2 changes: 1 addition & 1 deletion Orbit 7/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.Mav3r1ck.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
36 changes: 20 additions & 16 deletions Orbit 7/Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ class Menu: SKScene {

var alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("Spiraling",ofType: "wav")!)

var error:NSError?
audioPlayer = AVAudioPlayer(contentsOfURL: alertSound, error: &error)
audioPlayer.prepareToPlay()
audioPlayer.play()
audioPlayer.numberOfLoops = -1
do {
audioPlayer = try AVAudioPlayer(contentsOfURL: alertSound)
audioPlayer.prepareToPlay()
audioPlayer.play()
audioPlayer.numberOfLoops = -1
} catch var error1 as NSError {
print(error1)
}


// Level Label
mygameLabel.fontName = "DIN Condensed"
Expand All @@ -48,8 +52,8 @@ class Menu: SKScene {

// Add Stars!
let stars = SKEmitterNode(fileNamed: "Stars")
stars.position = CGPointMake(400, 200)
addChild(stars)
stars!.position = CGPointMake(400, 200)
addChild(stars!)

// Background Color
backgroundColor = SKColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1)
Expand Down Expand Up @@ -82,13 +86,13 @@ class Menu: SKScene {


if reverseOrbit == false {
let orbitActionTwo = SKAction.followPath(spriteKitPath, asOffset: false, orientToPath: true, duration: duration)
let orbitActionTwo = SKAction.followPath(spriteKitPath!, asOffset: false, orientToPath: true, duration: duration)
shape.runAction(SKAction.repeatActionForever(orbitActionTwo))

} else if reverseOrbit == true {


let orbitActionTwo = SKAction.followPath(spriteKitPath, asOffset: false, orientToPath: true, duration: duration)
let orbitActionTwo = SKAction.followPath(spriteKitPath!, asOffset: false, orientToPath: true, duration: duration)
shape.runAction(SKAction.repeatActionForever(orbitActionTwo.reversedAction()))
}

Expand All @@ -103,27 +107,27 @@ class Menu: SKScene {

// Green Asteroid
let greenCircleOrbitSize = CGSize(width: 200 , height: 200)
addOrbitingToShape(greenNode, greenCircleOrbitSize, 90, false, 8)
addOrbitingToShape(greenNode, orbitSize: greenCircleOrbitSize, rotateDegrees: 90, reverseOrbit: false, duration: 8)
greenNode.name = "greenDot"
addChild(greenNode)

// Red Asteroid
let redCircleOrbitSize = CGSize(width: sunNode.xScale + 280, height: sunNode.yScale + 500)
addOrbitingToShape(redNode, redCircleOrbitSize, 330, false, 5)
addOrbitingToShape(redNode, orbitSize: redCircleOrbitSize, rotateDegrees: 330, reverseOrbit: false, duration: 5)
redNode.name = "redDot"
addChild(redNode)


// Blue Asteroid
let blueCircleOrbitSize = CGSize(width: 500 , height: 540)
addOrbitingToShape(blueNode, blueCircleOrbitSize, 90, true, 5)
addOrbitingToShape(blueNode, orbitSize: blueCircleOrbitSize, rotateDegrees: 90, reverseOrbit: true, duration: 5)
blueNode.name = "blueDot"
addChild(blueNode)


// Purple Asteroid
let purpleCircleOrbitSize = CGSize(width: 700 , height: 650)
addOrbitingToShape(purpleNode, purpleCircleOrbitSize, 45, true, 15)
addOrbitingToShape(purpleNode, orbitSize: purpleCircleOrbitSize, rotateDegrees: 45, reverseOrbit: true, duration: 15)
purpleNode.name = "purpleDot"
addChild(purpleNode)

Expand All @@ -133,10 +137,10 @@ class Menu: SKScene {


// Game Levels
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {

let touchLocation = (touches.first as? UITouch)?.locationInNode(self)
let node = self.nodeAtPoint(touchLocation!)
let touchLocation = (touches.first! as UITouch).locationInNode(self)
let node = self.nodeAtPoint(touchLocation)

audioPlayer.stop()

Expand Down
10 changes: 5 additions & 5 deletions Orbit 7/Shapes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ enum Shape: Int {
static func randomShape() -> Shape {
// Find out count of possible shapes
var maxValue = 0
while let _ = self(rawValue: ++maxValue) {}
while let _ = self.init(rawValue: ++maxValue) {}
// Generate random number from number of shapes
let randomNumber = Int(arc4random_uniform(UInt32(maxValue)))
// Create and return shape
let shape = self(rawValue: randomNumber)!
let shape = self.init(rawValue: randomNumber)!

return shape
}
Expand Down Expand Up @@ -90,9 +90,9 @@ let numbersAray = [3, 5, 7, 1, -1, -3, 5, -7]

func randomScore() -> Int {

var unsignedArraycount = UInt32(numbersAray.count)
var unsignedRandomNumber = arc4random_uniform(unsignedArraycount)
var randomNumber = Int(unsignedRandomNumber)
let unsignedArraycount = UInt32(numbersAray.count)
let unsignedRandomNumber = arc4random_uniform(unsignedArraycount)
let randomNumber = Int(unsignedRandomNumber)
return numbersAray[randomNumber]

}
2 changes: 1 addition & 1 deletion Orbit 7Tests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.Mav3r1ck.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down