Explanation
I'm trying to build a character selection menu similar to Crossy Road's one (as you can see here). So I found this iCarousel, which would help me with all of it, but everything I read talk about implementing it to a ViewController, which isn't my case. I'm using GameScene and I didn't found anything talking about it. Is there anyway I could implement it to my game? or even another effect similar to the character selection menu I mentioned above?
Code
I made a project with 3 square images (to apply the effect) as an example. But since I didn't find how to do it, and I don't know how to do it (yes, I tried), there isn't much code. You can use it as a start or to lead me to the answer. You can download it here.
GameScene.swift
import SpriteKit
class GameScene: SKScene {
override func didMoveToView(view: SKView) {
/* Setup your scene here */
let square1 = SKSpriteNode(imageNamed: "square1")
square1.anchorPoint = CGPointZero
square1.position = CGPoint(x: self.frame.width / 2 - square1.frame.width / 2, y: self.frame.height / 2 - square1.frame.height / 2)
self.addChild(square1)
let square2 = SKSpriteNode(imageNamed: "square2")
square2.anchorPoint = CGPointZero
//square2.position = CGPoint(x: self.frame.width / 2 - square2.frame.width / 2, y: self.frame.height / 2 - square2.frame.height / 2)
self.addChild(square2)
let square3 = SKSpriteNode(imageNamed: "square3")
square3.anchorPoint = CGPointZero
//square3.position = CGPoint(x: self.frame.width / 2 - square3.frame.width / 2, y: self.frame.height / 2 - square3.frame.height / 2)
self.addChild(square3)
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
/* Called when a touch begins */
}
override func update(currentTime: CFTimeInterval) {
/* Called before each frame is rendered */
}
}
Thanks in advance,
Luiz.
Aucun commentaire:
Enregistrer un commentaire