Create a Tetromino Puzzle Game Using Swift - Drawing Objects

Originally published at: http://www.sitepoint.com/create-tetromino-puzzle-game-using-swift-drawing-objects/

This entry is part 1 of 1 in the series Create a Tetromino Puzzle Game Using Swift

Create a Tetromino Puzzle Game Using Swift

  • 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:

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 */
}

}


Continue reading this article on SitePoint

This topic is now unlisted. It will no longer be displayed in any topic lists. The only way to access this topic is via direct link.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.