Friday, January 16, 2015

Create a Tetromino Puzzle Game Using Swift – Drawing Objects

The GameScene


Now it’s time to draw something on the screen. A GameScene class that extends SKScene was already declared for us by default in GameScene.swift. Update its definition with the following code:


[code language="objc"]class GameScene: SKScene { override func didMoveToView(view: SKView) { /* Setup your scene here */ let block = SKSpriteNode(color: SKColor.orangeColor(), size: CGSize(width: 50, height: 50)) block.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame)) self.addChild(block) } override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { /* Called when a touch begins */ for touch: AnyObject in touches { } } override func update(currentTime: CFTimeInterval) { /* Called before each frame is rendered */ } } [/code]

Continue reading %Create a Tetromino Puzzle Game Using Swift – Drawing Objects%




by Rico Zuniga via SitePoint

No comments:

Post a Comment