-3

i am making a sprite-kit game for IOS, and i want to add a something similar to a character select menu, how would i do that ?

searched around on the web and didn't find any pages that could solve my problem

Hades
  • 41
  • 6
  • 1
    Hades, your question is much too broad because there are dozens of ways to do what you are asking. I urge you to read what kind of questions are valid to ask. http://stackoverflow.com/help/asking – sangony Aug 29 '15 at 13:52
  • @sangony I know there are multiple ways of doing it, but i just need a pointer in the right direction, like a link to a webpage that shows how to do this or an example of one of those methods – Hades Aug 29 '15 at 13:58
  • Fair enough. Take a look at the written tutorials on the Ray Wenderlich site. http://www.raywenderlich.com – sangony Aug 29 '15 at 14:00

1 Answers1

2

What I would do is to create another view controller or SKScene.

If you are going to use an SKScene do:

  • You can add SpriteNodes to the shop menu and detect which sprite the user has clicked on.

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {

    for touch in (touches as! Set<UITouch>) {

        let touchLocation = touch.locationInNode(self)

        let touchedNode = nodeAtPoint(touchLocation)


    if touchedNode.name == ... {
        chosen character = touchednode
    } else if touchedNode.name == "Blah blah" { ... etc
  • or if you are using a view controller you may want to use a table view controller.

You can add a table-view controller and embed it in a navigation controller. The cells will have all the characters. When the user clicks a certain cell in the navigation controller, the clicked cell will be the chosen character. For more info you can go to apple's website: https://developer.apple.com/library/prerelease/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson7.html

Hope this helped.

Entitize
  • 4,553
  • 3
  • 20
  • 28