Sunday Discount - Lifetime Access for $20!!!! - Click Here!

Texture Events – Story Tellers iOS Starter Kit Documentation

  • SetTexture – A String when used as a TouchEvent or Dictionary when used as a non-Touch Event. See both examples below….

Setting Textures for SKSpriteNode 1

  • SetTextureSafely – same as above but will stop all actions on the Element (this is needed if the Element is animating textures)
  • SetTextureFromPool – A String when used as a TouchEvent or Dictionary when used as a non-Touch Event. As a String the value will be the Pool name. The Element will cycle through the textures in the pool starting with the first. When used as a Dictionary key (see below) each key will be the Element to change texture, and the value will be the Pool Name.

Setting Textures for SKSpriteNode 2

  • SetRandomTextureFromPool – You can randomize a texture by setting the value of pool. The pool should contain the names of possible textures to use. For example, Cloud1, Cloud2, etc.

Setting Textures for SKSpriteNode 3

  • SetTextureFromPreference –  The value should be equal to another value you set earlier (for example, using the SetValues dictionary or SetValuesIfNil dictionary). Essentially this is just an in-between reference to the texture. But like any variable, it can change over time. So the user might tap a button to change the value, then change the texture from the preference.

Setting Textures for SKSpriteNode 4

You could also do something like…..

Setting Textures for SKSpriteNode 5

Because SetValuesFromPool (and all SetValue-related code is run first), the event cycles through a new value from the pool, then uses that value for the texture. This would be a great way to cycle through things like clothing choices for a character in your book.



Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!