0

I have a texture which looks likes -> enter image description here

Now I want to create a Sprite which looks like

enter image description here

How would I go about doing this in Sprite Kit project?

Bavan
  • 1,021
  • 1
  • 10
  • 24
  • A **single** sprite which is composed of four transformed sprites? – WangYudong Oct 08 '15 at 13:32
  • Skewing is not supported directly in SpriteKit - You may have to split the sprite into 4 smaller sprites, and assign smaller textures to them (there is a initializer for SKTexture that takes as input a base texture and a crop rectangle region) - to skew the sprite you may need to use a custom shader that will skew the texture content. – Benzi Oct 08 '15 at 15:48
  • spritekit isnt real good at this kinda thing unfortunately =/ you have to find workarounds to accomplish this kind of effect.. – hamobi Oct 08 '15 at 16:07
  • Would it be possible to create a sprite with a `CGPath` that is the outline of what you want, and then set the texture? I'm not sure if that will crop it to the `CGPath` "outline" though. – Gliderman Oct 08 '15 at 17:51
  • When In was playing with OpenGL, I was able to draw this very easily. First get the texture from the image above(first one). Then set the texture's Wrapping parameter to GL_REPEAT. And then setting the glVertexAttribPointer of vertex and associated texture coordinates in the draw call. However, I want to use the feature SpriteKit provides via the node hierarchy (mainly physics). Since Sprite Kit is written on top of OpenGL-ES, I thought this could be possible by overriding or extending some methods in SKSpriteNode class. :( – Bavan Oct 08 '15 at 19:36
  • Sprite composition with Texture splicing will not give the warp/skew effect I am after. :( – Bavan Oct 08 '15 at 19:44

0 Answers0