├── .gitignore ├── FlappyBird.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── FlappyBird ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── GameScene.sks ├── GameScene.swift ├── GameViewController.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── PipeDown.imageset │ │ ├── Contents.json │ │ └── PipeDown.png │ ├── PipeUp.imageset │ │ ├── Contents.json │ │ └── PipeUp.png │ ├── land.imageset │ │ ├── Contents.json │ │ └── land.png │ ├── scoreboard.imageset │ │ ├── Contents.json │ │ └── scoreboard.png │ └── sky.imageset │ │ ├── Contents.json │ │ └── sky.png ├── Info.plist ├── LaunchScreen.storyboard └── bird.atlas │ ├── bird-01.png │ ├── bird-02.png │ ├── bird-03.png │ └── bird-04.png ├── FlappyBirdTests ├── FlappyBirdTests.swift └── Info.plist ├── LICENSE.md └── README.mkd /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | Pods/ 27 | 28 | .DS_Store 29 | -------------------------------------------------------------------------------- /FlappyBird.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 43745200193D163700654986 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437451FF193D163700654986 /* AppDelegate.swift */; }; 11 | 43745202193D163700654986 /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 43745201193D163700654986 /* GameScene.sks */; }; 12 | 43745204193D163800654986 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43745203193D163800654986 /* GameScene.swift */; }; 13 | 43745206193D163800654986 /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43745205193D163800654986 /* GameViewController.swift */; }; 14 | 43745209193D163800654986 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43745207193D163800654986 /* Main.storyboard */; }; 15 | 4374520B193D163800654986 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4374520A193D163800654986 /* Images.xcassets */; }; 16 | 43745217193D163800654986 /* FlappyBirdTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43745216193D163800654986 /* FlappyBirdTests.swift */; }; 17 | 437A3DBA193D326A00909BA0 /* bird.atlas in Resources */ = {isa = PBXBuildFile; fileRef = 437A3DB9193D326A00909BA0 /* bird.atlas */; }; 18 | 6E1623E01E24FC4E00FB2C72 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6E1623DF1E24FC4E00FB2C72 /* LaunchScreen.storyboard */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 43745211193D163800654986 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 437451F2193D163700654986 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 437451F9193D163700654986; 27 | remoteInfo = FlappyBird; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 437451FA193D163700654986 /* FlappyBird.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FlappyBird.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 437451FE193D163700654986 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 437451FF193D163700654986 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 35 | 43745201193D163700654986 /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = ""; }; 36 | 43745203193D163800654986 /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; }; 37 | 43745205193D163800654986 /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; 38 | 43745208193D163800654986 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 4374520A193D163800654986 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 43745210193D163800654986 /* FlappyBirdTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FlappyBirdTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 43745215193D163800654986 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 43745216193D163800654986 /* FlappyBirdTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlappyBirdTests.swift; sourceTree = ""; }; 43 | 437A3DB9193D326A00909BA0 /* bird.atlas */ = {isa = PBXFileReference; lastKnownFileType = folder.skatlas; path = bird.atlas; sourceTree = ""; }; 44 | 6E1623DF1E24FC4E00FB2C72 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 437451F7193D163700654986 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | 4374520D193D163800654986 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 437451F1193D163700654986 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 437451FC193D163700654986 /* FlappyBird */, 69 | 43745213193D163800654986 /* FlappyBirdTests */, 70 | 437451FB193D163700654986 /* Products */, 71 | ); 72 | sourceTree = ""; 73 | usesTabs = 0; 74 | }; 75 | 437451FB193D163700654986 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 437451FA193D163700654986 /* FlappyBird.app */, 79 | 43745210193D163800654986 /* FlappyBirdTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | 437451FC193D163700654986 /* FlappyBird */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 6E1623DF1E24FC4E00FB2C72 /* LaunchScreen.storyboard */, 88 | 437451FF193D163700654986 /* AppDelegate.swift */, 89 | 43745201193D163700654986 /* GameScene.sks */, 90 | 43745203193D163800654986 /* GameScene.swift */, 91 | 43745205193D163800654986 /* GameViewController.swift */, 92 | 43745207193D163800654986 /* Main.storyboard */, 93 | 4374520A193D163800654986 /* Images.xcassets */, 94 | 437A3DB9193D326A00909BA0 /* bird.atlas */, 95 | 437451FD193D163700654986 /* Supporting Files */, 96 | ); 97 | path = FlappyBird; 98 | sourceTree = ""; 99 | }; 100 | 437451FD193D163700654986 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 437451FE193D163700654986 /* Info.plist */, 104 | ); 105 | name = "Supporting Files"; 106 | sourceTree = ""; 107 | }; 108 | 43745213193D163800654986 /* FlappyBirdTests */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 43745216193D163800654986 /* FlappyBirdTests.swift */, 112 | 43745214193D163800654986 /* Supporting Files */, 113 | ); 114 | path = FlappyBirdTests; 115 | sourceTree = ""; 116 | }; 117 | 43745214193D163800654986 /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 43745215193D163800654986 /* Info.plist */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | /* End PBXGroup section */ 126 | 127 | /* Begin PBXNativeTarget section */ 128 | 437451F9193D163700654986 /* FlappyBird */ = { 129 | isa = PBXNativeTarget; 130 | buildConfigurationList = 4374521A193D163800654986 /* Build configuration list for PBXNativeTarget "FlappyBird" */; 131 | buildPhases = ( 132 | 437451F6193D163700654986 /* Sources */, 133 | 437451F7193D163700654986 /* Frameworks */, 134 | 437451F8193D163700654986 /* Resources */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = FlappyBird; 141 | productName = FlappyBird; 142 | productReference = 437451FA193D163700654986 /* FlappyBird.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | 4374520F193D163800654986 /* FlappyBirdTests */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = 4374521D193D163800654986 /* Build configuration list for PBXNativeTarget "FlappyBirdTests" */; 148 | buildPhases = ( 149 | 4374520C193D163800654986 /* Sources */, 150 | 4374520D193D163800654986 /* Frameworks */, 151 | 4374520E193D163800654986 /* Resources */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | 43745212193D163800654986 /* PBXTargetDependency */, 157 | ); 158 | name = FlappyBirdTests; 159 | productName = FlappyBirdTests; 160 | productReference = 43745210193D163800654986 /* FlappyBirdTests.xctest */; 161 | productType = "com.apple.product-type.bundle.unit-test"; 162 | }; 163 | /* End PBXNativeTarget section */ 164 | 165 | /* Begin PBXProject section */ 166 | 437451F2193D163700654986 /* Project object */ = { 167 | isa = PBXProject; 168 | attributes = { 169 | LastSwiftMigration = 0700; 170 | LastSwiftUpdateCheck = 0700; 171 | LastUpgradeCheck = 1110; 172 | ORGANIZATIONNAME = Fullstack.io; 173 | TargetAttributes = { 174 | 437451F9193D163700654986 = { 175 | CreatedOnToolsVersion = 6.0; 176 | LastSwiftMigration = 1110; 177 | }; 178 | 4374520F193D163800654986 = { 179 | CreatedOnToolsVersion = 6.0; 180 | LastSwiftMigration = 1110; 181 | TestTargetID = 437451F9193D163700654986; 182 | }; 183 | }; 184 | }; 185 | buildConfigurationList = 437451F5193D163700654986 /* Build configuration list for PBXProject "FlappyBird" */; 186 | compatibilityVersion = "Xcode 3.2"; 187 | developmentRegion = en; 188 | hasScannedForEncodings = 0; 189 | knownRegions = ( 190 | en, 191 | Base, 192 | ); 193 | mainGroup = 437451F1193D163700654986; 194 | productRefGroup = 437451FB193D163700654986 /* Products */; 195 | projectDirPath = ""; 196 | projectRoot = ""; 197 | targets = ( 198 | 437451F9193D163700654986 /* FlappyBird */, 199 | 4374520F193D163800654986 /* FlappyBirdTests */, 200 | ); 201 | }; 202 | /* End PBXProject section */ 203 | 204 | /* Begin PBXResourcesBuildPhase section */ 205 | 437451F8193D163700654986 /* Resources */ = { 206 | isa = PBXResourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | 4374520B193D163800654986 /* Images.xcassets in Resources */, 210 | 43745202193D163700654986 /* GameScene.sks in Resources */, 211 | 437A3DBA193D326A00909BA0 /* bird.atlas in Resources */, 212 | 6E1623E01E24FC4E00FB2C72 /* LaunchScreen.storyboard in Resources */, 213 | 43745209193D163800654986 /* Main.storyboard in Resources */, 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | }; 217 | 4374520E193D163800654986 /* Resources */ = { 218 | isa = PBXResourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | /* End PBXResourcesBuildPhase section */ 225 | 226 | /* Begin PBXSourcesBuildPhase section */ 227 | 437451F6193D163700654986 /* Sources */ = { 228 | isa = PBXSourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 43745204193D163800654986 /* GameScene.swift in Sources */, 232 | 43745206193D163800654986 /* GameViewController.swift in Sources */, 233 | 43745200193D163700654986 /* AppDelegate.swift in Sources */, 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | }; 237 | 4374520C193D163800654986 /* Sources */ = { 238 | isa = PBXSourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | 43745217193D163800654986 /* FlappyBirdTests.swift in Sources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXSourcesBuildPhase section */ 246 | 247 | /* Begin PBXTargetDependency section */ 248 | 43745212193D163800654986 /* PBXTargetDependency */ = { 249 | isa = PBXTargetDependency; 250 | target = 437451F9193D163700654986 /* FlappyBird */; 251 | targetProxy = 43745211193D163800654986 /* PBXContainerItemProxy */; 252 | }; 253 | /* End PBXTargetDependency section */ 254 | 255 | /* Begin PBXVariantGroup section */ 256 | 43745207193D163800654986 /* Main.storyboard */ = { 257 | isa = PBXVariantGroup; 258 | children = ( 259 | 43745208193D163800654986 /* Base */, 260 | ); 261 | name = Main.storyboard; 262 | sourceTree = ""; 263 | }; 264 | /* End PBXVariantGroup section */ 265 | 266 | /* Begin XCBuildConfiguration section */ 267 | 43745218193D163800654986 /* Debug */ = { 268 | isa = XCBuildConfiguration; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 272 | CLANG_CXX_LIBRARY = "libc++"; 273 | CLANG_ENABLE_MODULES = YES; 274 | CLANG_ENABLE_OBJC_ARC = YES; 275 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 276 | CLANG_WARN_BOOL_CONVERSION = YES; 277 | CLANG_WARN_COMMA = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_EMPTY_BODY = YES; 282 | CLANG_WARN_ENUM_CONVERSION = YES; 283 | CLANG_WARN_INFINITE_RECURSION = YES; 284 | CLANG_WARN_INT_CONVERSION = YES; 285 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 286 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 287 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 288 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 289 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 290 | CLANG_WARN_STRICT_PROTOTYPES = YES; 291 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 292 | CLANG_WARN_UNREACHABLE_CODE = YES; 293 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 294 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 295 | COPY_PHASE_STRIP = NO; 296 | ENABLE_STRICT_OBJC_MSGSEND = YES; 297 | ENABLE_TESTABILITY = YES; 298 | GCC_C_LANGUAGE_STANDARD = gnu99; 299 | GCC_DYNAMIC_NO_PIC = NO; 300 | GCC_NO_COMMON_BLOCKS = YES; 301 | GCC_OPTIMIZATION_LEVEL = 0; 302 | GCC_PREPROCESSOR_DEFINITIONS = ( 303 | "DEBUG=1", 304 | "$(inherited)", 305 | ); 306 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 307 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 308 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 309 | GCC_WARN_UNDECLARED_SELECTOR = YES; 310 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 311 | GCC_WARN_UNUSED_FUNCTION = YES; 312 | GCC_WARN_UNUSED_VARIABLE = YES; 313 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 314 | METAL_ENABLE_DEBUG_INFO = YES; 315 | ONLY_ACTIVE_ARCH = YES; 316 | SDKROOT = iphoneos; 317 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 318 | TARGETED_DEVICE_FAMILY = "1,2"; 319 | }; 320 | name = Debug; 321 | }; 322 | 43745219193D163800654986 /* Release */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 327 | CLANG_CXX_LIBRARY = "libc++"; 328 | CLANG_ENABLE_MODULES = YES; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_COMMA = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 336 | CLANG_WARN_EMPTY_BODY = YES; 337 | CLANG_WARN_ENUM_CONVERSION = YES; 338 | CLANG_WARN_INFINITE_RECURSION = YES; 339 | CLANG_WARN_INT_CONVERSION = YES; 340 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 341 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 342 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 345 | CLANG_WARN_STRICT_PROTOTYPES = YES; 346 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 347 | CLANG_WARN_UNREACHABLE_CODE = YES; 348 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 349 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 350 | COPY_PHASE_STRIP = YES; 351 | ENABLE_NS_ASSERTIONS = NO; 352 | ENABLE_STRICT_OBJC_MSGSEND = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 362 | METAL_ENABLE_DEBUG_INFO = NO; 363 | SDKROOT = iphoneos; 364 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 365 | TARGETED_DEVICE_FAMILY = "1,2"; 366 | VALIDATE_PRODUCT = YES; 367 | }; 368 | name = Release; 369 | }; 370 | 4374521B193D163800654986 /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 374 | INFOPLIST_FILE = FlappyBird/Info.plist; 375 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 376 | PRODUCT_BUNDLE_IDENTIFIER = "io.fullstack.${PRODUCT_NAME:rfc1034identifier}"; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 379 | SWIFT_VERSION = 5.0; 380 | }; 381 | name = Debug; 382 | }; 383 | 4374521C193D163800654986 /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 387 | INFOPLIST_FILE = FlappyBird/Info.plist; 388 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 389 | PRODUCT_BUNDLE_IDENTIFIER = "io.fullstack.${PRODUCT_NAME:rfc1034identifier}"; 390 | PRODUCT_NAME = "$(TARGET_NAME)"; 391 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 392 | SWIFT_VERSION = 5.0; 393 | }; 394 | name = Release; 395 | }; 396 | 4374521E193D163800654986 /* Debug */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/FlappyBird.app/FlappyBird"; 400 | FRAMEWORK_SEARCH_PATHS = ( 401 | "$(SDKROOT)/Developer/Library/Frameworks", 402 | "$(inherited)", 403 | ); 404 | GCC_PREPROCESSOR_DEFINITIONS = ( 405 | "DEBUG=1", 406 | "$(inherited)", 407 | ); 408 | INFOPLIST_FILE = FlappyBirdTests/Info.plist; 409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 410 | METAL_ENABLE_DEBUG_INFO = YES; 411 | PRODUCT_BUNDLE_IDENTIFIER = "io.fullstack.${PRODUCT_NAME:rfc1034identifier}"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 414 | SWIFT_VERSION = 5.0; 415 | TEST_HOST = "$(BUNDLE_LOADER)"; 416 | }; 417 | name = Debug; 418 | }; 419 | 4374521F193D163800654986 /* Release */ = { 420 | isa = XCBuildConfiguration; 421 | buildSettings = { 422 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/FlappyBird.app/FlappyBird"; 423 | FRAMEWORK_SEARCH_PATHS = ( 424 | "$(SDKROOT)/Developer/Library/Frameworks", 425 | "$(inherited)", 426 | ); 427 | INFOPLIST_FILE = FlappyBirdTests/Info.plist; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 429 | METAL_ENABLE_DEBUG_INFO = NO; 430 | PRODUCT_BUNDLE_IDENTIFIER = "io.fullstack.${PRODUCT_NAME:rfc1034identifier}"; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 433 | SWIFT_VERSION = 5.0; 434 | TEST_HOST = "$(BUNDLE_LOADER)"; 435 | }; 436 | name = Release; 437 | }; 438 | /* End XCBuildConfiguration section */ 439 | 440 | /* Begin XCConfigurationList section */ 441 | 437451F5193D163700654986 /* Build configuration list for PBXProject "FlappyBird" */ = { 442 | isa = XCConfigurationList; 443 | buildConfigurations = ( 444 | 43745218193D163800654986 /* Debug */, 445 | 43745219193D163800654986 /* Release */, 446 | ); 447 | defaultConfigurationIsVisible = 0; 448 | defaultConfigurationName = Release; 449 | }; 450 | 4374521A193D163800654986 /* Build configuration list for PBXNativeTarget "FlappyBird" */ = { 451 | isa = XCConfigurationList; 452 | buildConfigurations = ( 453 | 4374521B193D163800654986 /* Debug */, 454 | 4374521C193D163800654986 /* Release */, 455 | ); 456 | defaultConfigurationIsVisible = 0; 457 | defaultConfigurationName = Release; 458 | }; 459 | 4374521D193D163800654986 /* Build configuration list for PBXNativeTarget "FlappyBirdTests" */ = { 460 | isa = XCConfigurationList; 461 | buildConfigurations = ( 462 | 4374521E193D163800654986 /* Debug */, 463 | 4374521F193D163800654986 /* Release */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | /* End XCConfigurationList section */ 469 | }; 470 | rootObject = 437451F2193D163700654986 /* Project object */; 471 | } 472 | -------------------------------------------------------------------------------- /FlappyBird.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FlappyBird.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FlappyBird/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // FlappyBird 4 | // 5 | // Created by Nate Murray on 6/2/14. 6 | // Copyright (c) 2014 Fullstack.io. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /FlappyBird/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /FlappyBird/GameScene.sks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/GameScene.sks -------------------------------------------------------------------------------- /FlappyBird/GameScene.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameScene.swift 3 | // FlappyBird 4 | // 5 | // Created by Nate Murray on 6/2/14. 6 | // Copyright (c) 2014 Fullstack.io. All rights reserved. 7 | // 8 | 9 | import SpriteKit 10 | 11 | class GameScene: SKScene, SKPhysicsContactDelegate{ 12 | let verticalPipeGap = 150.0 13 | 14 | var bird:SKSpriteNode! 15 | var skyColor:SKColor! 16 | var pipeTextureUp:SKTexture! 17 | var pipeTextureDown:SKTexture! 18 | var movePipesAndRemove:SKAction! 19 | var moving:SKNode! 20 | var pipes:SKNode! 21 | var canRestart = Bool() 22 | var scoreLabelNode:SKLabelNode! 23 | var score = NSInteger() 24 | 25 | let birdCategory: UInt32 = 1 << 0 26 | let worldCategory: UInt32 = 1 << 1 27 | let pipeCategory: UInt32 = 1 << 2 28 | let scoreCategory: UInt32 = 1 << 3 29 | 30 | override func didMove(to view: SKView) { 31 | 32 | canRestart = true 33 | 34 | // setup physics 35 | self.physicsWorld.gravity = CGVector( dx: 0.0, dy: -5.0 ) 36 | self.physicsWorld.contactDelegate = self 37 | 38 | // setup background color 39 | skyColor = SKColor(red: 81.0/255.0, green: 192.0/255.0, blue: 201.0/255.0, alpha: 1.0) 40 | self.backgroundColor = skyColor 41 | 42 | moving = SKNode() 43 | self.addChild(moving) 44 | pipes = SKNode() 45 | moving.addChild(pipes) 46 | 47 | // ground 48 | let groundTexture = SKTexture(imageNamed: "land") 49 | groundTexture.filteringMode = .nearest // shorter form for SKTextureFilteringMode.Nearest 50 | 51 | let moveGroundSprite = SKAction.moveBy(x: -groundTexture.size().width * 2.0, y: 0, duration: TimeInterval(0.02 * groundTexture.size().width * 2.0)) 52 | let resetGroundSprite = SKAction.moveBy(x: groundTexture.size().width * 2.0, y: 0, duration: 0.0) 53 | let moveGroundSpritesForever = SKAction.repeatForever(SKAction.sequence([moveGroundSprite,resetGroundSprite])) 54 | 55 | for i in 0 ..< 2 + Int(self.frame.size.width / ( groundTexture.size().width * 2 )) { 56 | let i = CGFloat(i) 57 | let sprite = SKSpriteNode(texture: groundTexture) 58 | sprite.setScale(2.0) 59 | sprite.position = CGPoint(x: i * sprite.size.width, y: sprite.size.height / 2.0) 60 | sprite.run(moveGroundSpritesForever) 61 | moving.addChild(sprite) 62 | } 63 | 64 | // skyline 65 | let skyTexture = SKTexture(imageNamed: "sky") 66 | skyTexture.filteringMode = .nearest 67 | 68 | let moveSkySprite = SKAction.moveBy(x: -skyTexture.size().width * 2.0, y: 0, duration: TimeInterval(0.1 * skyTexture.size().width * 2.0)) 69 | let resetSkySprite = SKAction.moveBy(x: skyTexture.size().width * 2.0, y: 0, duration: 0.0) 70 | let moveSkySpritesForever = SKAction.repeatForever(SKAction.sequence([moveSkySprite,resetSkySprite])) 71 | 72 | for i in 0 ..< 2 + Int(self.frame.size.width / ( skyTexture.size().width * 2 )) { 73 | let i = CGFloat(i) 74 | let sprite = SKSpriteNode(texture: skyTexture) 75 | sprite.setScale(2.0) 76 | sprite.zPosition = -20 77 | sprite.position = CGPoint(x: i * sprite.size.width, y: sprite.size.height / 2.0 + groundTexture.size().height * 2.0) 78 | sprite.run(moveSkySpritesForever) 79 | moving.addChild(sprite) 80 | } 81 | 82 | // create the pipes textures 83 | pipeTextureUp = SKTexture(imageNamed: "PipeUp") 84 | pipeTextureUp.filteringMode = .nearest 85 | pipeTextureDown = SKTexture(imageNamed: "PipeDown") 86 | pipeTextureDown.filteringMode = .nearest 87 | 88 | // create the pipes movement actions 89 | let distanceToMove = CGFloat(self.frame.size.width + 2.0 * pipeTextureUp.size().width) 90 | let movePipes = SKAction.moveBy(x: -distanceToMove, y:0.0, duration:TimeInterval(0.01 * distanceToMove)) 91 | let removePipes = SKAction.removeFromParent() 92 | movePipesAndRemove = SKAction.sequence([movePipes, removePipes]) 93 | 94 | // spawn the pipes 95 | let spawn = SKAction.run(spawnPipes) 96 | let delay = SKAction.wait(forDuration: TimeInterval(2.0)) 97 | let spawnThenDelay = SKAction.sequence([spawn, delay]) 98 | let spawnThenDelayForever = SKAction.repeatForever(spawnThenDelay) 99 | self.run(spawnThenDelayForever) 100 | 101 | // setup our bird 102 | let birdTexture1 = SKTexture(imageNamed: "bird-01") 103 | birdTexture1.filteringMode = .nearest 104 | let birdTexture2 = SKTexture(imageNamed: "bird-02") 105 | birdTexture2.filteringMode = .nearest 106 | 107 | let anim = SKAction.animate(with: [birdTexture1, birdTexture2], timePerFrame: 0.2) 108 | let flap = SKAction.repeatForever(anim) 109 | 110 | bird = SKSpriteNode(texture: birdTexture1) 111 | bird.setScale(2.0) 112 | bird.position = CGPoint(x: self.frame.size.width * 0.35, y:self.frame.size.height * 0.6) 113 | bird.run(flap) 114 | 115 | 116 | bird.physicsBody = SKPhysicsBody(circleOfRadius: bird.size.height / 2.0) 117 | bird.physicsBody?.isDynamic = true 118 | bird.physicsBody?.allowsRotation = false 119 | 120 | bird.physicsBody?.categoryBitMask = birdCategory 121 | bird.physicsBody?.collisionBitMask = worldCategory | pipeCategory 122 | bird.physicsBody?.contactTestBitMask = worldCategory | pipeCategory 123 | 124 | self.addChild(bird) 125 | 126 | // create the ground 127 | let ground = SKNode() 128 | ground.position = CGPoint(x: 0, y: groundTexture.size().height) 129 | ground.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: self.frame.size.width, height: groundTexture.size().height * 2.0)) 130 | ground.physicsBody?.isDynamic = false 131 | ground.physicsBody?.categoryBitMask = worldCategory 132 | self.addChild(ground) 133 | 134 | // Initialize label and create a label which holds the score 135 | score = 0 136 | scoreLabelNode = SKLabelNode(fontNamed:"MarkerFelt-Wide") 137 | scoreLabelNode.position = CGPoint( x: self.frame.midX, y: 3 * self.frame.size.height / 4 ) 138 | scoreLabelNode.zPosition = 100 139 | scoreLabelNode.text = String(score) 140 | self.addChild(scoreLabelNode) 141 | 142 | } 143 | 144 | func spawnPipes() { 145 | let pipePair = SKNode() 146 | pipePair.position = CGPoint( x: self.frame.size.width + pipeTextureUp.size().width * 2, y: 0 ) 147 | pipePair.zPosition = -10 148 | 149 | let height = UInt32( self.frame.size.height / 4) 150 | let y = Double(arc4random_uniform(height) + height) 151 | 152 | let pipeDown = SKSpriteNode(texture: pipeTextureDown) 153 | pipeDown.setScale(2.0) 154 | pipeDown.position = CGPoint(x: 0.0, y: y + Double(pipeDown.size.height) + verticalPipeGap) 155 | 156 | 157 | pipeDown.physicsBody = SKPhysicsBody(rectangleOf: pipeDown.size) 158 | pipeDown.physicsBody?.isDynamic = false 159 | pipeDown.physicsBody?.categoryBitMask = pipeCategory 160 | pipeDown.physicsBody?.contactTestBitMask = birdCategory 161 | pipePair.addChild(pipeDown) 162 | 163 | let pipeUp = SKSpriteNode(texture: pipeTextureUp) 164 | pipeUp.setScale(2.0) 165 | pipeUp.position = CGPoint(x: 0.0, y: y) 166 | 167 | pipeUp.physicsBody = SKPhysicsBody(rectangleOf: pipeUp.size) 168 | pipeUp.physicsBody?.isDynamic = false 169 | pipeUp.physicsBody?.categoryBitMask = pipeCategory 170 | pipeUp.physicsBody?.contactTestBitMask = birdCategory 171 | pipePair.addChild(pipeUp) 172 | 173 | let contactNode = SKNode() 174 | contactNode.position = CGPoint( x: pipeDown.size.width + bird.size.width / 2, y: self.frame.midY ) 175 | contactNode.physicsBody = SKPhysicsBody(rectangleOf: CGSize( width: pipeUp.size.width, height: self.frame.size.height )) 176 | contactNode.physicsBody?.isDynamic = false 177 | contactNode.physicsBody?.categoryBitMask = scoreCategory 178 | contactNode.physicsBody?.contactTestBitMask = birdCategory 179 | pipePair.addChild(contactNode) 180 | 181 | pipePair.run(movePipesAndRemove) 182 | pipes.addChild(pipePair) 183 | 184 | } 185 | 186 | func resetScene (){ 187 | // Move bird to original position and reset velocity 188 | bird.position = CGPoint(x: self.frame.size.width / 2.5, y: self.frame.midY) 189 | bird.physicsBody?.velocity = CGVector( dx: 0, dy: 0 ) 190 | bird.physicsBody?.collisionBitMask = worldCategory | pipeCategory 191 | bird.speed = 1.0 192 | bird.zRotation = 0.0 193 | 194 | // Remove all existing pipes 195 | pipes.removeAllChildren() 196 | 197 | // Reset _canRestart 198 | canRestart = false 199 | 200 | // Reset score 201 | score = 0 202 | scoreLabelNode.text = String(score) 203 | 204 | // Restart animation 205 | moving.speed = 1 206 | } 207 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 208 | if moving.speed > 0 { 209 | for _ in touches { // do we need all touches? 210 | bird.physicsBody?.velocity = CGVector(dx: 0, dy: 0) 211 | bird.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 30)) 212 | } 213 | } else if canRestart { 214 | self.resetScene() 215 | } 216 | } 217 | 218 | override func update(_ currentTime: TimeInterval) { 219 | /* Called before each frame is rendered */ 220 | let value = bird.physicsBody!.velocity.dy * ( bird.physicsBody!.velocity.dy < 0 ? 0.003 : 0.001 ) 221 | bird.zRotation = min( max(-1, value), 0.5 ) 222 | } 223 | 224 | func didBegin(_ contact: SKPhysicsContact) { 225 | if moving.speed > 0 { 226 | if ( contact.bodyA.categoryBitMask & scoreCategory ) == scoreCategory || ( contact.bodyB.categoryBitMask & scoreCategory ) == scoreCategory { 227 | // Bird has contact with score entity 228 | score += 1 229 | scoreLabelNode.text = String(score) 230 | 231 | // Add a little visual feedback for the score increment 232 | scoreLabelNode.run(SKAction.sequence([SKAction.scale(to: 1.5, duration:TimeInterval(0.1)), SKAction.scale(to: 1.0, duration:TimeInterval(0.1))])) 233 | } else { 234 | 235 | moving.speed = 0 236 | 237 | bird.physicsBody?.collisionBitMask = worldCategory 238 | bird.run( SKAction.rotate(byAngle: CGFloat(Double.pi) * CGFloat(bird.position.y) * 0.01, duration:1), completion:{self.bird.speed = 0 }) 239 | 240 | 241 | // Flash background if contact is detected 242 | self.removeAction(forKey: "flash") 243 | self.run(SKAction.sequence([SKAction.repeat(SKAction.sequence([SKAction.run({ 244 | self.backgroundColor = SKColor(red: 1, green: 0, blue: 0, alpha: 1.0) 245 | }),SKAction.wait(forDuration: TimeInterval(0.05)), SKAction.run({ 246 | self.backgroundColor = self.skyColor 247 | }), SKAction.wait(forDuration: TimeInterval(0.05))]), count:4), SKAction.run({ 248 | self.canRestart = true 249 | })]), withKey: "flash") 250 | } 251 | } 252 | } 253 | } 254 | -------------------------------------------------------------------------------- /FlappyBird/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // FlappyBird 4 | // 5 | // Created by Nate Murray on 6/2/14. 6 | // Copyright (c) 2014 Fullstack.io. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | extension SKNode { 13 | class func unarchiveFromFile(_ file : String) -> SKNode? { 14 | 15 | let path = Bundle.main.path(forResource: file, ofType: "sks") 16 | 17 | let sceneData: Data? 18 | do { 19 | sceneData = try Data(contentsOf: URL(fileURLWithPath: path!), options: .mappedIfSafe) 20 | } catch _ { 21 | sceneData = nil 22 | } 23 | let archiver = NSKeyedUnarchiver(forReadingWith: sceneData!) 24 | 25 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") 26 | let scene = archiver.decodeObject(forKey: NSKeyedArchiveRootObjectKey) as! GameScene 27 | archiver.finishDecoding() 28 | return scene 29 | } 30 | } 31 | 32 | class GameViewController: UIViewController { 33 | 34 | override func viewDidLoad() { 35 | super.viewDidLoad() 36 | 37 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { 38 | // Configure the view. 39 | let skView = self.view as! SKView 40 | skView.showsFPS = true 41 | skView.showsNodeCount = true 42 | 43 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 44 | skView.ignoresSiblingOrder = true 45 | 46 | /* Set the scale mode to scale to fit the window */ 47 | scene.scaleMode = .aspectFill 48 | 49 | skView.presentScene(scene) 50 | } 51 | } 52 | 53 | override var shouldAutorotate : Bool { 54 | return true 55 | } 56 | 57 | override var supportedInterfaceOrientations : UIInterfaceOrientationMask { 58 | if UIDevice.current.userInterfaceIdiom == .phone { 59 | return UIInterfaceOrientationMask.allButUpsideDown 60 | } else { 61 | return UIInterfaceOrientationMask.all 62 | } 63 | } 64 | 65 | override func didReceiveMemoryWarning() { 66 | super.didReceiveMemoryWarning() 67 | // Release any cached data, images, etc that aren't in use. 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/PipeDown.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "PipeDown.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/PipeDown.imageset/PipeDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/Images.xcassets/PipeDown.imageset/PipeDown.png -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/PipeUp.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "PipeUp.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/PipeUp.imageset/PipeUp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/Images.xcassets/PipeUp.imageset/PipeUp.png -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/land.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "land.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/land.imageset/land.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/Images.xcassets/land.imageset/land.png -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/scoreboard.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "scoreboard.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/scoreboard.imageset/scoreboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/Images.xcassets/scoreboard.imageset/scoreboard.png -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/sky.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "sky.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /FlappyBird/Images.xcassets/sky.imageset/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/Images.xcassets/sky.imageset/sky.png -------------------------------------------------------------------------------- /FlappyBird/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarHidden 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /FlappyBird/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /FlappyBird/bird.atlas/bird-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/bird.atlas/bird-01.png -------------------------------------------------------------------------------- /FlappyBird/bird.atlas/bird-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/bird.atlas/bird-02.png -------------------------------------------------------------------------------- /FlappyBird/bird.atlas/bird-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/bird.atlas/bird-03.png -------------------------------------------------------------------------------- /FlappyBird/bird.atlas/bird-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newlinedotco/FlappySwift/28f566e9ae4c7b240ecd4a90f30e0c943564bad8/FlappyBird/bird.atlas/bird-04.png -------------------------------------------------------------------------------- /FlappyBirdTests/FlappyBirdTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FlappyBirdTests.swift 3 | // FlappyBirdTests 4 | // 5 | // Created by Nate Murray on 6/2/14. 6 | // Copyright (c) 2014 Fullstack.io. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class FlappyBirdTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measure() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /FlappyBirdTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright © 2015 Nate Murray & Fullstack.io 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the “Software”), to deal in the Software without 9 | restriction, including without limitation the rights to use, 10 | copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | -------------------------------------------------------------------------------- /README.mkd: -------------------------------------------------------------------------------- 1 | [![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=55dd277abbda430100397040&branch=master&build=latest)](https://dashboard.buddybuild.com/apps/55dd277abbda430100397040/build/latest) 2 | 3 | # FlappySwift 4 | 5 | An implementation of Flappy Bird in Swift for iOS 8. 6 | 7 | ![FlappySwift](http://i.imgur.com/1NLoToU.gif) 8 | 9 | # Notes 10 | 11 | We're launching a course [Game Programming with Swift](https://fullstackedu.com) 12 | 13 | If you are interested in early access to the course, head to [fullstackedu.com](https://www.fullstackedu.com) and _enter in your email in the signup box at the bottom of the page_ to be notified of updates on the course itself. 14 | 15 | # Authors 16 | 17 | - Nate Murray - [@eigenjoy](https://twitter.com/eigenjoy) 18 | - Ari Lerner - [@auser](https://twitter.com/auser) 19 | - Based on code by [Matthias Gall](http://digitalbreed.com/2014/how-to-build-a-game-like-flappy-bird-with-xcode-and-sprite-kit) 20 | 21 | --------------------------------------------------------------------------------