Skip to content

Latest commit

 

History

History
52 lines (32 loc) · 1.47 KB

README.md

File metadata and controls

52 lines (32 loc) · 1.47 KB

TrippyBackgrounds - iOS

For the recent iOS game I am developing I wrote a simple helper class for my game to generate totaly random image for a scene background. I think the outcome is really nice and useful for backgrounds, textures, etc.

So I've uploaded a sample SpriteKit project if anyone would be interested to use it.

Class responsible for creating image is

SabilandTB.swift

Usage (generated image is SQUARE -> max(width, height))

// NOTE: WIDTH and HEIGHT must be >= 1.0
let generator = SabilandTB(width: 500.0, height: 200.0)
let trippyImage = generator.SabilandTrippyBackground

Example how to use it in a SpriteKit game as a background image

let background = SKNode()
background.addChild(SKSpriteNode(texture: SKTexture(CGImage: trippyImage.CGImage!)))
background.position = CGPointMake(MasterSKView.frame.midX, MasterSKView.frame.midY)
self.addChild(background)

Examples of fully-randomly-generated images. These are just a few examples.

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text