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
391 changes: 391 additions & 0 deletions Contained-game/Contained-game.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Contained-game.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
62 changes: 62 additions & 0 deletions Contained-game/Contained-game/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
52 changes: 52 additions & 0 deletions Contained-game/Contained-game/Models/CustomScene.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// CustomScene.swift
// Contained-game
//
// Created by Mike Nichols on 5/18/20.
// Copyright © 2020 Mike Nichols. All rights reserved.
//

import Foundation
import SpriteKit

class CustomScene: SKScene {
let crab = SKSpriteNode()

// Add and center child, initializing animation sequence
override func sceneDidLoad() {
super.sceneDidLoad()
addChild(crab)
crab.loadTextures(named: "HappyCrab", forKey: SKSpriteNode.textureKey)
crab.position = CGPoint(x: frame.midX, y: frame.midY)
}

// Move to touch
public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

// Fetch a touch or leave
guard !touches.isEmpty, let touch = touches.first else { return }

// Retrieve position
let position = touch.location(in: self)

// Create move action
let actionDuration = 1.0
let moveAction = SKAction.move(to: position, duration: actionDuration)

let rollAction = SKAction.rotate(byAngle: CGFloat.pi * 2, duration: actionDuration)
let zoomAction = SKAction.scale(by: 1.3, duration: 0.3)
let unzoomAction = SKAction.scale(to: 1.0, duration: 0.1)

switch Settings.shared.shouldZoom {
case false:
crab.run(moveAction)
case true:
let sequenceAction = SKAction.sequence([zoomAction, moveAction, unzoomAction])
crab.run(sequenceAction)
}

if Settings.shared.shouldRoll {
crab.run(rollAction)
}
}
}
23 changes: 23 additions & 0 deletions Contained-game/Contained-game/Models/GameViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// GameViewController.swift
// Contained-game
//
// Created by Mike Nichols on 5/18/20.
// Copyright © 2020 Mike Nichols. All rights reserved.
//

import UIKit
import SpriteKit

class GameViewController: UIViewController {

@IBOutlet weak var mySKView: SKView!

var skscene: CustomScene? = nil

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
skscene = CustomScene(size: view.bounds.size)
mySKView.presentScene(skscene)
}
}
35 changes: 35 additions & 0 deletions Contained-game/Contained-game/Models/InfoViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// InfoViewController.swift
// Contained-game
//
// Created by Mike Nichols on 5/18/20.
// Copyright © 2020 Mike Nichols. All rights reserved.
//

import UIKit

class InfoViewController: UIViewController {

@IBAction func done(_ sender: Any) {
navigationController?.popToRootViewController(animated: true)
}

override func viewDidLoad() {
super.viewDidLoad()


// Do any additional setup after loading the view.
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can delete this if you're not using it.

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}
25 changes: 25 additions & 0 deletions Contained-game/Contained-game/Models/SettingsViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// SettingsViewController.swift
// Contained-game
//
// Created by Mike Nichols on 5/18/20.
// Copyright © 2020 Mike Nichols. All rights reserved.
//

import UIKit

class SettingsViewController: UIViewController {

@IBAction func toggleRoll(_ sender: UISwitch) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take the value of the switch and assign that value to an instance variable for our class object.

}
@IBAction func toggleZoom (_ sender: UISwitch) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take the value of the switch and assign that value to an instance variable for our class object.

}

override func viewDidLoad() {
super.viewDidLoad()

}

}
17 changes: 17 additions & 0 deletions Contained-game/Contained-game/Models/settings.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Settings.swift
// Contained-game
//
// Created by Mike Nichols on 5/18/20.
// Copyright © 2020 Mike Nichols. All rights reserved.
//

import Foundation

class Settings {
static let shared = Settings()
private init() {}

var shouldRoll = false
var shouldZoom = false
}
37 changes: 37 additions & 0 deletions Contained-game/Contained-game/Resources/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// AppDelegate.swift
// Contained-game
//
// Created by Mike Nichols on 5/18/20.
// Copyright © 2020 Mike Nichols. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading