• Unlikely Objects
  • Ludography
    • Nonoku
    • Acquisition
    • Image Mark Up
  • About
Menu

Unlikely Objects

  • Unlikely Objects
  • Ludography
  • Pint Sized Planet
    • Nonoku
    • Acquisition
    • Image Mark Up
  • About

Nonoku - Adding Some Color

November 17, 2016

Just a small update this time. Added some placeholder tiles to the board. A little bit of tidying as well. Mostly moving some values into constants for re-use elsewhere. The only thing of note is using an SKCropNode with a rounded rect, set to the same size as the board, so that the tiles always fit within the same space.

private func addTiles(parent: SKNode) {
        let tileColor: [UIColor] = [SKColor(colorLiteralRed: 200/255, green: 182/255, blue: 240/255, alpha: 1),
                                    SKColor(colorLiteralRed: 164/255, green: 134/255, blue: 222/255, alpha: 1),
                                    SKColor(colorLiteralRed: 131/255, green: 95/255, blue: 200/255, alpha: 1)]
        let tileSize = boardWidth / 10
        for col in 0..<10 {
            for row in 0..<10 {
                let xValue = CGFloat(col)
                let yValue = CGFloat(row)
                let rect = CGRect(x: tileSize * xValue, y: tileSize * yValue, width: tileSize, height: tileSize)
                let tile = SKShapeNode(rect: rect)
                tile.fillColor = tileColor[((row * 10) + col) % tileColor.count]
                tile.strokeColor = tile.fillColor
                parent.addChild(tile)

            }
        }
    }
In An Evening of Code Tags iOS, nonoku, Pint Sized Planet, indiedev
← Nonoku - Simple InteractionsNonoku - First Steps With SpriteKit →

Latest

Unlikely Objects
Fractal Plant in Godot
about a year ago
Binary Tree in Godot
about a year ago
Sierpinski Triangle in Godot
about a year ago
Re-visiting some old code
about a year ago
React - Starting a New Project
about 3 years ago
Satsuma Tosser
about 4 years ago
1HGJ #002: Deeper and Deeper
about 7 years ago
1HGJ #001: Telekinetic Bomberman Rush
about 7 years ago
Migrating to NSPersistentContainer
about 7 years ago
Nonoku - SpriteKit Shader
about 7 years ago

Powered by Squarespace