-4

I am a beginner developer and programmer and was wondering how to set up an iOS game so that there are levels which can be unlocked once you beat the previous one. Is it under the 'Game' and 'SpriteKit' settings to get started? Also, how is a physics engine setup? Sorry for my lack of knowledge haha.

Thanks

E. Brez
  • 1
  • 3

1 Answers1

0

I think that is too much to develop iOS game as first experience.

Anyway from the documentation

struct LevelTracker {
    static var highestUnlockedLevel = 1
    static func unlockLevel(level: Int) {
        if level > highestUnlockedLevel { highestUnlockedLevel = level }
    }
    static func levelIsUnlocked(level: Int) -> Bool {
        return level <= highestUnlockedLevel
    }
    var currentLevel = 1
    mutating func advanceToLevel(level: Int) -> Bool {
        if LevelTracker.levelIsUnlocked(level) {
            currentLevel = level
            return true
        } else {
            return false
        }
    }
}
Simone Pistecchia
  • 2,746
  • 3
  • 18
  • 30