0
votes

I just don't get it. For example: I'm making a game with enemies. I made some pics and put it into atlas. I want an enemy to stand still before he will collide with hero and then implement an animation. Should I add first pic from atlas to represent an enemy at first and then somehow add all atlas to that pic to animate it? Also, if I want to make the size of an enemy as twice the hero size: do I need to code it only for the first sprite (if I need to add it first) or for every sprite one after another or even the whole atlas itself? I can't understand how to interact with them! Also, I'm trying to make game universal, is that correct to name sprites like [email protected]; enemy001(at)2x.png; enemy001(at)3x.png and put it in one atlas? I'll appreciate any help with this, thanks! I'm coding it with swift if that matters.

1
You need to read a bit more before proceeding. I suggest you start with this: developer.apple.com/library/ios/documentation/GraphicsAnimation/… and then try out a couple of tutorials from here raywenderlich.com/tutorialssangony
Well, I did! I'm okay with regular xcassets but atlases are something terrifying for me. I also did Ray Wenderlich tutorial for atlases (raywenderlich.com/45152/…) But they aren't answering my questions as: how to resize something whose textures are into atlas by arranging it size property of a node (like I need to resize every sprite or not) or proper image naming. Ray suggests to name them @2x~ipad but I saw just @2x for example for universal devices. And so on.Burundanga

1 Answers

0
votes

Your question is too confusing in what your are specifically asking.

"I can't understand how to interact with them!"

is not a good question. You need to be more precise and break it down into several questions if need be. However, below are some pointers which might clarify some issues for you.

  1. You typically preload a texture atlas to avoid delays during your game play.

  2. When you init a SKSpriteNode you can either use a texture (preferred when using an atlas) or an image.

  3. To animate a sprite you run a sequence of images. There are several ways of accomplishing that. For example: -(SKAction *)animateWithTextures:(NSArray *)textures timePerFrame:(NSTimeInterval)sec would run an animation sequence of images placed into the NSArray.

  4. Sizing for different screen sizes has been asked numerous times on StackOverflow. Do a search and see what comes up.