Git Product home page Git Product logo

2048-spritebuilder-swift's People

Contributors

afbrandt avatar alengel avatar ben-g avatar dionlarson avatar makeschoolbot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

2048-spritebuilder-swift's Issues

p5 - keep track of high scores

func didLoadFromCCB() {
NSUserDefaults.standardUserDefaults().addObserver(self, forKeyPath: "highscore", options: .allZeros, context: nil)
updateHighScore()
}

NSKeyValueObserving options has no value ".allZeros" should use NSKeyValueObservingOptions.Old

func didLoadFromCCB() {
NSUserDefaults.standardUserDefaults().addObserver(self, forKeyPath: "highscore", options: NSKeyValueObservingOptions.Old, context: nil)
updateHighScore()
}

Part 1 should be split in two

It should be split into movement and merging - perhaps titled Movement and Game Logic (or some iteration on game logic) respectively.

Movement is a large conceptual unit which should be tackled by itself. Students will first ask about movement not tied into the game - they need to wrap their head around moving tiles around a grid.

Merging then assumes they have a firm grasp of the movement and they can move onto actual game logic. Below merging exists a lot of game logic, which is why it deserves a more general header.

Redundant headers

On the website, the header "X. Build your own 2048 with SpriteBuilder and Swift - Part X!" shows up at the beginning of every section.

Part 2 should be split in two

It should be split into Scoring and Polish.

The scoring includes keeping track of score and local high score storage, which is a conceptual unit.

The latter part involves the final visual touches - a separate conceptual unit.

Problems in Setting up classes in Xcode

1.I just copied the code and Xcode showed some issues about "fun setupBackground":
" backgroundTile is immutable"
then i added "as! CCNode" to "let backgroundTile = ..." and fixed it.

2.The function didLoadFromCCB need to be added to Grid.Class instead of Grid.swift or there would be an issue "use of unresolved identifier "setupBackground""
func didLoadFromCCB() {
setupBackground()
}

3.Last, I built the project successful, but it stopped running soon and the output:
2016-01-21 09:34:08.702 My2048Game[885:28936] cocos2d: animation started with frame interval: 60.00
2016-01-21 09:34:08.706 My2048Game[885:28936] cocos2d: surface size: 640x1136
2016-01-21 09:34:08.713 My2048Game[885:28936] CCBReader: Couldn't find member variable: backgroundNode
2016-01-21 09:34:08.713 My2048Game[885:28936] CCBReader: Couldn't find member variable: valueLabel
Could not cast value of type 'CCNode' (0x108cfcf98) to 'My2048Game.Tile' (0x108cfcb30).

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.