Coder Social home page Coder Social logo

skkinematics-game-tutorial's Introduction

Sprite Kit and Inverse Kinematics with Swift

  • Step by Step coding with my own comments for this tutorial
  • Great tutorial to help me learn Inverse Kinematics and understand Sprite Kit.
  • However, there are issues due to fast updating Swift and Xcode ... =\
  • Here is my notes that fix the tutorial issues. Hope it can help other who want to read this tutorial =]
    • My environment:
      • Xcode 7.3
      • Swift 2.2
      • Simulator: iPhone 6s & iPhone 6s plus
    • Screen size is designed for iPhone 5s, there are black gap on 6/6 plus and above
    • Swift 2.2 updates, remove hash tag (#)
      • change made in CGFloat+Extensions.swift: func random
    • New auto-generated GameViewController (in my opinion, API change)
      • create a new iOS game project, use the new auto-generated code to replace old one in the starting project
    • New API method, touchesBegan
      • use override func touchesBegan(touches: Set, withEvent event: UIEvent?)
    • IK Constraints Min and Max Angle properties doesn't work on the scene editor for Xcode 7.3
      • workaround to programmatically create a zRotation constraint: let range = SKRange(lowerLimit: CGFloat(0).degreesToRadians(), upperLimit: CGFloat(160).degreesToRadians()) let rotationConstraint = SKConstraint.zRotation(range) lowerArmFront.constraints = [rotationConstraint]
    • intersectsNode not working issue, more discussion on stack overflow, here is one possible solution
      • let effectorInNode = self.convertPoint(effectorNode.position, fromNode:effectorNode.parent!) var shurikenFrame = node.frame shurikenFrame.origin = self.convertPoint(shurikenFrame.origin, fromNode: node.parent!) if shurikenFrame.contains(effectorInNode) { ... <=replace=> if node.intersectsNode(effectorNode) { ...
    • GameOverScene some swift language update issues, including optional variables, as type cast. follow the Xcode hint to fix
    • AVAudioPlayer in Swift is different from it in Objective-C! It throws exception not with return error parameter
      • use simple try catch do { audioPlayer = try AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: path), fileTypeHint: "mp3") } catch { ... }

skkinematics-game-tutorial's People

Stargazers

Luke Van In avatar Romy avatar

Watchers

Long Zhen avatar

Forkers

shyamalschandra

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.