draw primitive objects in SpriteKit

Hello everybody,



I'm starting with de programming in Swift for the iPhone. The examples in Xcode with with the SpriteKit already work very well. Now I would like to draw a circle and a triangle with on the screen (no image, PNG or similar only a drawn area). Google could not really help me or I know not exactly what search terms I need.

I would like to draw a circle and triangle with certain coordinates as a colored area on the screen.

About tips or example, etc. I would be happy;)



Thank you and see you soon,



Thomas

Replies

There's an excellent set of resources here:


cartoonsmart.com


Regarding drawn shapes in Sprite Kit, you can do that with SKShapeNode object, but SKShapeNode is generally regarded as unsatisfactory (for both performance and rendering reasons). You are better off using SKSpriteNode. You can either import the shapes as images (or a texture atlas), or you can create the images you need (in the sizes you need them) at run-time.