diff --git a/8-bit version Brahms - Hungarian Dance No. 5.mp3 b/8-bit version Brahms - Hungarian Dance No. 5.mp3 new file mode 100644 index 0000000..ca134a0 Binary files /dev/null and b/8-bit version Brahms - Hungarian Dance No. 5.mp3 differ diff --git a/Duel Of Fates 8-Bit.mp3 b/Duel Of Fates 8-Bit.mp3 new file mode 100644 index 0000000..e8a6169 Binary files /dev/null and b/Duel Of Fates 8-Bit.mp3 differ diff --git a/Master of Puppets [8 Bit Tribute to Metallica] - 8 Bit Universe.mp3 b/Master of Puppets [8 Bit Tribute to Metallica] - 8 Bit Universe.mp3 new file mode 100644 index 0000000..f998535 Binary files /dev/null and b/Master of Puppets [8 Bit Tribute to Metallica] - 8 Bit Universe.mp3 differ diff --git a/Metallica - The Four Horsemen (8-bit).mp3 b/Metallica - The Four Horsemen (8-bit).mp3 new file mode 100644 index 0000000..1b6ccb3 Binary files /dev/null and b/Metallica - The Four Horsemen (8-bit).mp3 differ diff --git a/TankShebang.xcodeproj/project.pbxproj b/TankShebang.xcodeproj/project.pbxproj index c11fb87..a0acf63 100644 --- a/TankShebang.xcodeproj/project.pbxproj +++ b/TankShebang.xcodeproj/project.pbxproj @@ -17,6 +17,8 @@ 145A1C5523724421006D8603 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 145A1C5323724421006D8603 /* LaunchScreen.storyboard */; }; 145A1C6023724421006D8603 /* TankShebangTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 145A1C5F23724421006D8603 /* TankShebangTests.swift */; }; 145A1C6B23724421006D8603 /* TankShebangUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 145A1C6A23724421006D8603 /* TankShebangUITests.swift */; }; + 72C95286239048FD00EBAF27 /* Menu.sks in Resources */ = {isa = PBXBuildFile; fileRef = 72C95285239048FD00EBAF27 /* Menu.sks */; }; + 72C9528823904A2A00EBAF27 /* Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72C9528723904A2A00EBAF27 /* Menu.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -53,6 +55,8 @@ 145A1C6623724421006D8603 /* TankShebangUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TankShebangUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 145A1C6A23724421006D8603 /* TankShebangUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TankShebangUITests.swift; sourceTree = ""; }; 145A1C6C23724421006D8603 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 72C95285239048FD00EBAF27 /* Menu.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = Menu.sks; sourceTree = ""; }; + 72C9528723904A2A00EBAF27 /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -112,6 +116,8 @@ 145A1C5123724421006D8603 /* Assets.xcassets */, 145A1C5323724421006D8603 /* LaunchScreen.storyboard */, 145A1C5623724421006D8603 /* Info.plist */, + 72C95285239048FD00EBAF27 /* Menu.sks */, + 72C9528723904A2A00EBAF27 /* Menu.swift */, ); path = TankShebang; sourceTree = ""; @@ -238,6 +244,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 72C95286239048FD00EBAF27 /* Menu.sks in Resources */, 145A1C502372441F006D8603 /* Main.storyboard in Resources */, 145A1C472372441F006D8603 /* GameScene.sks in Resources */, 145A1C5223724421006D8603 /* Assets.xcassets in Resources */, @@ -269,6 +276,7 @@ files = ( 145A1C4B2372441F006D8603 /* GameScene.swift in Sources */, 145A1C4D2372441F006D8603 /* GameViewController.swift in Sources */, + 72C9528823904A2A00EBAF27 /* Menu.swift in Sources */, 145A1C452372441F006D8603 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -444,6 +452,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = TankShebang/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -461,6 +470,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = TankShebang/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/aru.xcuserdatad/UserInterfaceState.xcuserstate b/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/aru.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..b9c4547 Binary files /dev/null and b/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/aru.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/rbeit.xcuserdatad/UserInterfaceState.xcuserstate b/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/rbeit.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..01f1205 Binary files /dev/null and b/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/rbeit.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/sean.xcuserdatad/UserInterfaceState.xcuserstate b/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/sean.xcuserdatad/UserInterfaceState.xcuserstate index 58556aa..afe5ff6 100644 Binary files a/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/sean.xcuserdatad/UserInterfaceState.xcuserstate and b/TankShebang.xcodeproj/project.xcworkspace/xcuserdata/sean.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TankShebang.xcodeproj/xcshareddata/xcschemes/TankShebang.xcscheme b/TankShebang.xcodeproj/xcshareddata/xcschemes/TankShebang.xcscheme new file mode 100644 index 0000000..cc3ca69 --- /dev/null +++ b/TankShebang.xcodeproj/xcshareddata/xcschemes/TankShebang.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TankShebang.xcodeproj/xcuserdata/aru.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/TankShebang.xcodeproj/xcuserdata/aru.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..8e64326 --- /dev/null +++ b/TankShebang.xcodeproj/xcuserdata/aru.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/TankShebang.xcodeproj/xcuserdata/aru.xcuserdatad/xcschemes/xcschememanagement.plist b/TankShebang.xcodeproj/xcuserdata/aru.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..484d097 --- /dev/null +++ b/TankShebang.xcodeproj/xcuserdata/aru.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + TankShebang.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/TankShebang.xcodeproj/xcuserdata/rbeit.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/TankShebang.xcodeproj/xcuserdata/rbeit.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/TankShebang.xcodeproj/xcuserdata/rbeit.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/TankShebang.xcodeproj/xcuserdata/rbeit.xcuserdatad/xcschemes/xcschememanagement.plist b/TankShebang.xcodeproj/xcuserdata/rbeit.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..484d097 --- /dev/null +++ b/TankShebang.xcodeproj/xcuserdata/rbeit.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + TankShebang.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/TankShebang/AdvancedOptionsViewController.swift b/TankShebang/AdvancedOptionsViewController.swift new file mode 100644 index 0000000..eb96eac --- /dev/null +++ b/TankShebang/AdvancedOptionsViewController.swift @@ -0,0 +1,96 @@ +// +// AdvancedOptionsViewController.swift +// TankShebang +// +// Created by Robert Beit on 12/3/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// + +import UIKit + +class AdvancedOptionsViewController: UIViewController { + var auto = "On" + var power = "On" + var spawn = "On" + var scatter = "On" + + @IBOutlet weak var Autobalance: UIButton! + + @IBOutlet weak var Powerups: UIButton! + + @IBOutlet weak var Fixedspawn: UIButton! + + @IBOutlet weak var Scattershot: UIButton! + + + @IBAction func autobalance(_ sender: Any) { + if(auto == "Off"){ + auto = "On" + } + if(auto == "On"){ + auto = "Off" + } + Autobalance.setTitle(auto, for: .normal) + + } + + + @IBAction func powerups(_ sender: Any) { + if(power == "Off"){ + power = "On" + } + if(power == "On"){ + power = "Off" + } + Powerups.setTitle(power, for: .normal) + } + + @IBAction func fixedspawn(_ sender: Any) { + if(spawn == "Off"){ + spawn = "On" + } + if(spawn == "On"){ + spawn = "Off" + } + Fixedspawn.setTitle(spawn, for: .normal) + } + + @IBAction func scattershot(_ sender: Any) { + if(scatter == "On"){ + scatter = "Off" + } + if(scatter == "Off"){ + scatter = "On" + } + Scattershot.setTitle(scatter, for: .normal) + + } + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + var game_options = segue.destination as! GameOptionsViewController + game_options.AutoBalance = auto + game_options.Powerups = power + game_options.FixedSpawn = spawn + game_options.ScatterShot = scatter + + } + + + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + + /* + // 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. + } + */ + +} diff --git a/TankShebang/Assets.xcassets/DESERT.imageset/Contents.json b/TankShebang/Assets.xcassets/DESERT.imageset/Contents.json new file mode 100644 index 0000000..7c205d0 --- /dev/null +++ b/TankShebang/Assets.xcassets/DESERT.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "DESERT.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/DESERT.imageset/DESERT.png b/TankShebang/Assets.xcassets/DESERT.imageset/DESERT.png new file mode 100644 index 0000000..2fb891b Binary files /dev/null and b/TankShebang/Assets.xcassets/DESERT.imageset/DESERT.png differ diff --git a/TankShebang/Assets.xcassets/ICe.imageset/Contents.json b/TankShebang/Assets.xcassets/ICe.imageset/Contents.json new file mode 100644 index 0000000..447e80a --- /dev/null +++ b/TankShebang/Assets.xcassets/ICe.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ICe.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/ICe.imageset/ICe.png b/TankShebang/Assets.xcassets/ICe.imageset/ICe.png new file mode 100644 index 0000000..236620a Binary files /dev/null and b/TankShebang/Assets.xcassets/ICe.imageset/ICe.png differ diff --git a/TankShebang/Assets.xcassets/Options.imageset/Contents.json b/TankShebang/Assets.xcassets/Options.imageset/Contents.json new file mode 100644 index 0000000..91473f9 --- /dev/null +++ b/TankShebang/Assets.xcassets/Options.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Options.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/Options.imageset/Options.png b/TankShebang/Assets.xcassets/Options.imageset/Options.png new file mode 100644 index 0000000..518223e Binary files /dev/null and b/TankShebang/Assets.xcassets/Options.imageset/Options.png differ diff --git a/TankShebang/Assets.xcassets/POWERUP.imageset/Contents.json b/TankShebang/Assets.xcassets/POWERUP.imageset/Contents.json new file mode 100644 index 0000000..ced315c --- /dev/null +++ b/TankShebang/Assets.xcassets/POWERUP.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "POWERUP.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/POWERUP.imageset/POWERUP.png b/TankShebang/Assets.xcassets/POWERUP.imageset/POWERUP.png new file mode 100644 index 0000000..a6ccf19 Binary files /dev/null and b/TankShebang/Assets.xcassets/POWERUP.imageset/POWERUP.png differ diff --git a/TankShebang/Assets.xcassets/Sound.imageset/Contents.json b/TankShebang/Assets.xcassets/Sound.imageset/Contents.json new file mode 100644 index 0000000..a25c7a9 --- /dev/null +++ b/TankShebang/Assets.xcassets/Sound.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Sound.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/Sound.imageset/Sound.png b/TankShebang/Assets.xcassets/Sound.imageset/Sound.png new file mode 100644 index 0000000..3a8bcff Binary files /dev/null and b/TankShebang/Assets.xcassets/Sound.imageset/Sound.png differ diff --git a/TankShebang/Assets.xcassets/Start.imageset/Contents.json b/TankShebang/Assets.xcassets/Start.imageset/Contents.json new file mode 100644 index 0000000..77ecf6b --- /dev/null +++ b/TankShebang/Assets.xcassets/Start.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Start.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/Start.imageset/Start.png b/TankShebang/Assets.xcassets/Start.imageset/Start.png new file mode 100644 index 0000000..9dd37f6 Binary files /dev/null and b/TankShebang/Assets.xcassets/Start.imageset/Start.png differ diff --git a/TankShebang/Assets.xcassets/Submit.imageset/Contents.json b/TankShebang/Assets.xcassets/Submit.imageset/Contents.json new file mode 100644 index 0000000..031138d --- /dev/null +++ b/TankShebang/Assets.xcassets/Submit.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Submit.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/Submit.imageset/Submit.png b/TankShebang/Assets.xcassets/Submit.imageset/Submit.png new file mode 100644 index 0000000..cd22e2f Binary files /dev/null and b/TankShebang/Assets.xcassets/Submit.imageset/Submit.png differ diff --git a/TankShebang/Assets.xcassets/Terrain.imageset/Contents.json b/TankShebang/Assets.xcassets/Terrain.imageset/Contents.json new file mode 100644 index 0000000..6d5d7c9 --- /dev/null +++ b/TankShebang/Assets.xcassets/Terrain.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Terrain.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/Terrain.imageset/Terrain.png b/TankShebang/Assets.xcassets/Terrain.imageset/Terrain.png new file mode 100644 index 0000000..4eb2278 Binary files /dev/null and b/TankShebang/Assets.xcassets/Terrain.imageset/Terrain.png differ diff --git a/TankShebang/Assets.xcassets/defaultProjectile.imageset/Contents.json b/TankShebang/Assets.xcassets/defaultProjectile.imageset/Contents.json new file mode 100644 index 0000000..3d8c86a --- /dev/null +++ b/TankShebang/Assets.xcassets/defaultProjectile.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ball.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/defaultProjectile.imageset/ball.png b/TankShebang/Assets.xcassets/defaultProjectile.imageset/ball.png new file mode 100644 index 0000000..34473da Binary files /dev/null and b/TankShebang/Assets.xcassets/defaultProjectile.imageset/ball.png differ diff --git a/TankShebang/Assets.xcassets/defaultProjectile.imageset/projectile.png b/TankShebang/Assets.xcassets/defaultProjectile.imageset/projectile.png new file mode 100644 index 0000000..ae73abd Binary files /dev/null and b/TankShebang/Assets.xcassets/defaultProjectile.imageset/projectile.png differ diff --git a/TankShebang/Assets.xcassets/defaultProjectile.imageset/projectile@2x.png b/TankShebang/Assets.xcassets/defaultProjectile.imageset/projectile@2x.png new file mode 100644 index 0000000..79073a5 Binary files /dev/null and b/TankShebang/Assets.xcassets/defaultProjectile.imageset/projectile@2x.png differ diff --git a/TankShebang/Assets.xcassets/tank-1.imageset/Contents.json b/TankShebang/Assets.xcassets/tank-1.imageset/Contents.json new file mode 100644 index 0000000..3a7288f --- /dev/null +++ b/TankShebang/Assets.xcassets/tank-1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "tank.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TankShebang/Assets.xcassets/tank-1.imageset/tank.png b/TankShebang/Assets.xcassets/tank-1.imageset/tank.png new file mode 100644 index 0000000..7f18cc3 Binary files /dev/null and b/TankShebang/Assets.xcassets/tank-1.imageset/tank.png differ diff --git a/TankShebang/Base.lproj/Main.storyboard b/TankShebang/Base.lproj/Main.storyboard index 5b38b79..447f68f 100644 --- a/TankShebang/Base.lproj/Main.storyboard +++ b/TankShebang/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -22,319 +22,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/TankShebang/GameOptionsViewController.swift b/TankShebang/GameOptionsViewController.swift new file mode 100644 index 0000000..7ee3e34 --- /dev/null +++ b/TankShebang/GameOptionsViewController.swift @@ -0,0 +1,93 @@ +// +// GameOptionsViewController.swift +// TankShebang +// +// Created by Robert Beit on 12/1/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// + +import UIKit + +class GameOptionsViewController: UIViewController { + + @IBOutlet weak var Level: UIButton! + @IBOutlet weak var KillLength: UIButton! + @IBOutlet weak var GameMode: UIButton! + let modes = ["Tank Hunter","Pilot Hunter","Deathmatch"] + var sound = String() + var music = String() + var AutoBalance = String() + var Powerups = String() + var FixedSpawn = String() + var ScatterShot = String() + var num_players = 0 + let kills = ["1","3","5"] + let levels = ["Open Space","Moon","Dance"] + var mode_start = 0 + var kill_start = 0 + var level_start = 0 + var level = "Open Space" + var kill = "3" + var mode = "Tank Hunter" + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + @IBAction func touchlevel(_ sender: Any) { + level_start += 1 + if(level_start > 2){ + level_start = 0 + } + Level.setTitle(levels[level_start], for: .normal) + level = levels[level_start] + } + + @IBAction func touchKillLength(_ sender: Any) { + kill_start += 1 + if(kill_start > 2){ + kill_start = 0 + } + KillLength.setTitle(kills[kill_start], for: .normal) + kill = kills[kill_start] + } + + @IBAction func touchGameMode(_ sender: Any) { + mode_start += 1 + if(mode_start > 2){ + mode_start = 0 + } + GameMode.setTitle(modes[mode_start], for: .normal) + mode = modes[mode_start] + } + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if(segue.identifier == "Game"){ + var game_view = segue.destination as! GameViewController + game_view.Mode = mode + game_view.Level = level + game_view.Kill = kill + game_view.num_players = num_players + game_view.music = music + game_view.sound = sound + game_view.AutoBalance = AutoBalance + game_view.Powerups = Powerups + game_view.FixedSpawn = FixedSpawn + game_view.ScatterShot = ScatterShot + + } + + + + } + /* + // 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. + } + */ + +} diff --git a/TankShebang/GameScene.swift b/TankShebang/GameScene.swift index e234bdb..e151e78 100644 --- a/TankShebang/GameScene.swift +++ b/TankShebang/GameScene.swift @@ -41,7 +41,7 @@ extension CGPoint { } class GameScene: SKScene { - + let player1 = SKSpriteNode(imageNamed: "tank") //player 1 tank let player1Right = SKSpriteNode(imageNamed: "red") //player 1 shoot button let player1Left = SKSpriteNode(imageNamed: "red") //player 1 turn button @@ -53,14 +53,19 @@ class GameScene: SKScene { let player2Left = SKSpriteNode(imageNamed: "red") //player 2 turn button var p2LeftPressed = false var p2RightPressed = false - + var TerrainType = "Rock" + var SoundType = "On" + var PowerupType = "On" + let tankRotateSpeed = 0.1 //tank turning speed override func didMove(to view: SKView) { - backgroundColor = SKColor.white - + NSLog(TerrainType) + NSLog(SoundType) + NSLog(PowerupType) + // player 1 tank and button positioning player1.position = CGPoint(x: size.width * 0.5, y: size.height * 0.1) player1Left.position = CGPoint(x: player1Left.size.width/2, y: player1Left.size.height/2) @@ -95,11 +100,13 @@ class GameScene: SKScene { // run(SKAction.repeatForever( // SKAction.run(moveTanksForward) // )) + } // Moves tank forward in the direction it is facing func moveTanksForward() { + print(SoundType) // some basic trigonometry to calculate direction tanks are moving let p1Direction = CGPoint(x:player1.position.x - sin(player1.zRotation) * 3,y:player1.position.y + cos(player1.zRotation) * 3) let p2Direction = CGPoint(x:player2.position.x - sin(player2.zRotation) * 3,y:player2.position.y + cos(player2.zRotation) * 3) @@ -215,14 +222,9 @@ class GameScene: SKScene { addChild(projectile) // 6 - Get the direction of where to shoot - let direction = offset.normalized() // 7 - Make it shoot far enough to be guaranteed off screen - let shootAmount = direction * 1000 - - // 8 - Add the shoot amount to the current position - let realDest = direc * 1000 - + // 9 - Create the actions let actionMove = SKAction.move(to: direc, duration: 2.0) let actionMoveDone = SKAction.removeFromParent() @@ -235,6 +237,7 @@ class GameScene: SKScene { override func update(_ currentTime: TimeInterval) { // Called before each frame is rendered + // move all tanks forward run(SKAction.run(moveTanksForward)) diff --git a/TankShebang/GameViewController.swift b/TankShebang/GameViewController.swift index b42ebe9..1f8274d 100644 --- a/TankShebang/GameViewController.swift +++ b/TankShebang/GameViewController.swift @@ -15,13 +15,21 @@ class GameViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - let scene = GameScene(size: view.bounds.size) - let skView = view as! SKView - skView.showsFPS = true - skView.showsNodeCount = true - skView.ignoresSiblingOrder = true - scene.scaleMode = .resizeFill - skView.presentScene(scene) + // let scene = Menu(size: view.bounds.size) + // let skView = view as! SKView + // skView.showsFPS = true + // skView.showsNodeCount = true + // skView.ignoresSiblingOrder = true + // scene.scaleMode = .resizeFill + // skView.presentScene(scene) + + if let view = self.view as! SKView? { + if let scene = SKScene(fileNamed: "Menu") { + scene.scaleMode = .aspectFit + + view.presentScene(scene) + } + } // if let view = self.view as! SKView? { // // Load the SKScene from 'GameScene.sks' diff --git a/TankShebang/Menu.sks b/TankShebang/Menu.sks new file mode 100644 index 0000000..1321695 Binary files /dev/null and b/TankShebang/Menu.sks differ diff --git a/TankShebang/Menu.swift b/TankShebang/Menu.swift new file mode 100644 index 0000000..0285696 --- /dev/null +++ b/TankShebang/Menu.swift @@ -0,0 +1,150 @@ +// +// Menu.swift +// TankShebang +// +// Created by Aryan Agarwal on 11/29/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// + +import SpriteKit + +class Menu: SKScene { + var startButton:SKSpriteNode! + var optionsButton:SKSpriteNode! + var TerrainButton:SKSpriteNode! + var PowerUpButton:SKSpriteNode! + var SoundButton:SKSpriteNode! + var AutoBalanceButton:SKSpriteNode! + var FixedSpawnButton:SKSpriteNode! + var ScatterShotButton:SKSpriteNode! + var counter: Int = 0 + var counter2: Int = 0 + var counter3: Int = 0 + + override func didMove(to view: SKView){ + + } + + + override func touchesBegan(_ touches: Set, with event: UIEvent?) { + + for touch in touches { + let location = touch.location(in: self) + let node : SKNode = self.atPoint(location) + if node.name == "Terrain" { + if let label = self.childNode(withName: "Style") as? SKLabelNode { + if counter % 2 == 0 { + label.text = "Ice" + counter+=1 + } else { + label.text = "Rock" + counter+=1 + + } + + + + + } + + } else if node.name == "Start" { + // let label = self.childNode(withName: "Style") as? SKLabelNode + let reveal = SKTransition.reveal(with: .down, duration: 1) + + let Start = GameScene(size: self.size) + let label = self.childNode(withName: "Style") as? SKLabelNode + let label2 = self.childNode(withName: "PowerLabel") as? SKLabelNode + let label3 = self.childNode(withName: "Label2") as? SKLabelNode + + + if( label!.text == nil){ + label!.text = "Ice" + } + if( label2!.text == nil){ + label!.text = "On" + } + if( label3!.text == nil){ + label!.text = "On" + } + + + Start.TerrainType = label!.text! + Start.PowerupType = label2!.text! + Start.SoundType = label3!.text! + self.view?.presentScene(Start, transition: reveal) + + let gameScene = GameScene(size: view!.bounds.size) + view!.presentScene(gameScene) + gameScene.TerrainType = label!.text! + gameScene.PowerupType = label2!.text! + gameScene.SoundType = label3!.text! + + + } else if node.name == "Sound" { + + if let label2 = self.childNode(withName: "Label2") as? SKLabelNode { + if counter2 % 2 == 0 { + label2.text = "On" + counter2+=1 + } else { + label2.text = "Off" + counter2+=1 + + } + + } } else if node.name == "Powerup" { + + if let label3 = self.childNode(withName: "PowerLabel") as? SKLabelNode { + if counter3 % 2 == 0 { + label3.text = "On" + counter3+=1 + } else { + label3.text = "Off" + counter3+=1 + + } + } + + } + + + + + + + + + + + + // let touch = touches.first + + // if let location = touch?.location(in:self){ + + // let nodeArray = self.nodes(at: location) + + // if nodeArray.first?.name == "Start" { + + // let transition = SKTransition.flipHorizontal(withDuration: 0.5) + + // let gameScene = GameScene(size: self.size) + // self.view?.presentScene(gameScene, transition: transition) + + + // } else if nodeArray.first?.name == "Options" { + // let transition2 = SKTransition.flipHorizontal(withDuration: 0.5) + + // let gameScene2 = Options(size: self.size) + // self.view?.presentScene(gameScene2, transition: transition2) + // } + + + + // } + } + + + + +} +} diff --git a/TankShebang/Options.swift b/TankShebang/Options.swift new file mode 100644 index 0000000..f6688cd --- /dev/null +++ b/TankShebang/Options.swift @@ -0,0 +1,64 @@ +// +// Options.swift +// TankShebang +// +// Created by Robert Beit on 11/28/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// + +import UIKit + +class Options: UIViewController { + + + @IBOutlet weak var music: UIButton! + @IBOutlet weak var sound: UIButton! + var sound1 = String() + var music1 = String() + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + var titleview = segue.destination as! TitleViewController + titleview.Sound = sound1 + titleview.Music = music1 + + } + + @IBAction func soundeffects(_ sender: Any) { + if( sound.titleLabel?.text == "On"){ + sound.setTitle("Off", for: .normal) + sound1 = "Off" + } + if(sound.titleLabel?.text == "Off"){ + sound.setTitle("On", for: .normal) + sound1 = "On" + + } + } + + @IBAction func musiceffect(_ sender: Any) { + if(music.titleLabel?.text == "On"){ + music.setTitle("Off", for: .normal) + music1 = "Off" + } + if(music.titleLabel?.text == "Off"){ + music.setTitle("On", for: .normal) + music1 = "On" + + } + } + + /* + // 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. + } + */ + +} diff --git a/TankShebang/Player.swift b/TankShebang/Player.swift new file mode 100644 index 0000000..a45aef2 --- /dev/null +++ b/TankShebang/Player.swift @@ -0,0 +1,132 @@ +// +// Player.swift +// TankShebang +// +// Created by Sean Cao on 12/2/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// +import Foundation + +import SpriteKit + +class Player: SKSpriteNode { + + var directionState:String = "forward" + var health:Int = 2 + var invincible:Bool = false + var shield:Bool = false + var ammo:Int = 4 + + var roundScore:Int = 0 + var gameScore:Int = 0 + + + func addShield(){ + if (!shield) { + let Circle = SKShapeNode(circleOfRadius: self.size.height) // Size of Circle + Circle.name = "shield" + Circle.position = CGPoint(x:0,y:0) //Middle of Screen + Circle.strokeColor = SKColor.blue + Circle.glowWidth = 1.0 + // Circle.physicsBody = SKPhysicsBody(circleOfRadius: self.size.height) + // Circle.physicsBody?.isDynamic = false + // Circle.physicsBody?.categoryBitMask = PhysicsCategory.shield + // Circle.physicsBody?.contactTestBitMask = PhysicsCategory.shot + // Circle.physicsBody?.collisionBitMask = PhysicsCategory.none + self.addChild(Circle) + shield = true + } + } + + // Moves tank forward forward or backward + func drive(tankMoveSpeed:CGFloat) { + + if (health > 0){ + var direction: CGPoint + + // some basic trigonometry to calculate direction tanks are moving + if ( directionState == "forward" ) { + direction = CGPoint(x:self.position.x - sin(self.zRotation) * tankMoveSpeed,y:self.position.y + cos(self.zRotation) * tankMoveSpeed) + } else { + direction = CGPoint(x:self.position.x + sin(self.zRotation) * tankMoveSpeed,y:self.position.y - cos(self.zRotation) * tankMoveSpeed) + } + + let moveTank = SKAction.move(to: direction, duration:0) + + + self.run(moveTank) + } + } + + func hit() { + + if (shield) { + if let shieldNode = self.childNode(withName: "shield") as? SKShapeNode { + shieldNode.removeFromParent() + } + shield = false + } else { + if (!invincible){ + health -= 1 + } + } + + if (health == 0){ + self.removeFromParent() + } else { + temporaryInvincibility() + } + } + + func temporaryInvincibility() { + let fadeOut = SKAction.fadeAlpha(to: 0.4, duration: 0.25) + let fadeIn = SKAction.fadeAlpha(to: 1, duration: 0.25) + + let seq:SKAction = SKAction.sequence( [ fadeOut, fadeIn ]) + + self.run(seq) + + invincible = true + + let seconds = 0.5 + DispatchQueue.main.asyncAfter(deadline: .now() + seconds) { + self.invincible = false + } + } + + // func fireProjectile() { + // + // print(self.zRotation) + // print(sin(self.zRotation)) + // print(cos(self.zRotation)) + // + // if ( self.ammo > 0 ) { + // let projectile = SKSpriteNode(imageNamed: "defaultProjectile") + // let direction = CGPoint(x:-1*sin(self.zRotation) * 2000,y:cos(self.zRotation) * 2000) + // let xDirection = self.position.x - sin(self.zRotation) + (-35 * sin(self.zRotation)) + // let yDirection = self.position.y + cos(self.zRotation) + (35 * cos(self.zRotation)) + // + // projectile.position = CGPoint(x: xDirection,y:yDirection) + // + // projectile.physicsBody = SKPhysicsBody(circleOfRadius: projectile.size.width/2) + // projectile.physicsBody?.isDynamic = true + // projectile.physicsBody?.categoryBitMask = PhysicsCategory.shot + // projectile.physicsBody?.contactTestBitMask = PhysicsCategory.p1 | PhysicsCategory.p2 | PhysicsCategory.p3 | PhysicsCategory.p4 | PhysicsCategory.obstacle + // projectile.physicsBody?.collisionBitMask = PhysicsCategory.none + // projectile.physicsBody?.usesPreciseCollisionDetection = true + // + // addChild(projectile) + // + // let shoot = SKAction.move(to: direction, duration: 2.0) + // let shootDone = SKAction.removeFromParent() + // projectile.run(SKAction.sequence([shoot, shootDone])) + // + // self.ammo -= 1 + // } + // } + + @objc func reload() { + self.ammo += 1 + } + +} diff --git a/TankShebang/PlayerSelectViewController.swift b/TankShebang/PlayerSelectViewController.swift new file mode 100644 index 0000000..c3c6ba9 --- /dev/null +++ b/TankShebang/PlayerSelectViewController.swift @@ -0,0 +1,116 @@ +// +// PlayerSelectViewController.swift +// TankShebang +// +// Created by Robert Beit on 12/3/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// + +import UIKit + +class PlayerSelectViewController: UIViewController { + + @IBOutlet weak var tank1: UIImageView! + + @IBOutlet weak var tank2: UIImageView! + + @IBOutlet weak var tank3: UIImageView! + + + @IBOutlet weak var tank4: UIImageView! + + + @IBOutlet weak var player1: UIButton! + + @IBOutlet weak var player2: UIButton! + + @IBOutlet weak var player3: UIButton! + + @IBOutlet weak var player4: UIButton! + var player1status = "Off" + var player2status = "Off" + var player3status = "Off" + var player4status = "Off" + var num_players = 0 + var Music = String() + var Sound = String() + + @IBAction func touchplayer1(_ sender: Any) { + if(player1status == "Off"){ + player1status = "On" + num_players += 1 + tank1.image = UIImage(named:"tank-1.png") + print("Running") + } + if(player1status == "On"){ + player1status = "Off" + tank1.image = nil + num_players -= 1 + } + + } + + @IBAction func touchplayer2(_ sender: Any) { + if(player2status == "Off"){ + player2status = "On" + num_players += 1 + tank2.image = UIImage(named:"tank-1.png") + } + if(player2status == "On"){ + player2status = "Off" + num_players -= 1 + tank2.image = nil + } + } + + @IBAction func touchplayer3(_ sender: Any) { + if(player2status == "Off"){ + player2status = "On" + num_players += 1 + tank2.image = UIImage(named:"tank-1.png") + } + if(player2status == "On"){ + player2status = "Off" + num_players -= 1 + tank2.image = nil + } + } + + @IBAction func touchplayer4(_ sender: Any) { + if(player1status == "Off"){ + player1status = "On" + num_players += 1 + tank1.image = UIImage(named:"tank-1.png") + } + if(player1status == "On"){ + player1status = "Off" + num_players -= 1 + tank1.image = nil + } + } + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + var game_options = segue.destination as! GameOptionsViewController + game_options.num_players = num_players + game_options.music = Music + game_options.sound = Sound + + + } + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + + /* + // 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. + } + */ + +} diff --git a/TankShebang/Projectile.swift b/TankShebang/Projectile.swift new file mode 100644 index 0000000..f04f933 --- /dev/null +++ b/TankShebang/Projectile.swift @@ -0,0 +1,18 @@ + + +// +// Projectile.swift +// TankShebang +// +// Created by Sean Cao on 12/3/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// +import Foundation + +import SpriteKit + +class Projectile: SKSpriteNode { + + var owner:Player = Player() + +} diff --git a/TankShebang/TitleViewController.swift b/TankShebang/TitleViewController.swift new file mode 100644 index 0000000..f0f1b70 --- /dev/null +++ b/TankShebang/TitleViewController.swift @@ -0,0 +1,44 @@ +// +// TitleViewController.swift +// TankShebang +// +// Created by Robert Beit on 12/1/19. +// Copyright © 2019 Sean Cao, Robert Beit, Aryan Aru Agarwal. All rights reserved. +// + +import UIKit + +class TitleViewController: UIViewController { +var Music = String() + var Sound = String() + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if(segue.identifier == "options"){ + } + if(segue.identifier == "select"){ + var game_options = segue.destination as! PlayerSelectViewController + + game_options.Music = Music + game_options.Sound = Sound + } + + + + } + + + /* + // 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. + } + */ + +} diff --git a/explosion.mp3 b/explosion.mp3 new file mode 100644 index 0000000..c11df3e Binary files /dev/null and b/explosion.mp3 differ