Sprite Kit art assets naming convention

不打扰是莪最后的温柔 提交于 2019-12-13 04:57:46

问题


Making my 1st Sprite Kit game & almost finished it. Just getting my images finalized. Problem is, with the addition of iPhone 6 & 6 Plus, I am having issues figuring out how to name my game assets. For instance, one of my several background images is called "1MBack.png". Sometimes people write "Default–568h@2x.png" and I try to figure out if I need the "Default–568h" part in my game asset names. The naming convention I used for my art is as following:

<< 1x (iPhone 2G, 3G, 3GS) = 1MBack.png >> << 2x (iPhone 4, 4s) = 1MBack@2x.png (640x1136) >> << Retina 4 2x (iPhone 5, 5s) = 1MBack@2x.png (750x1334) >> << 3x (iPhone 6 Plus) = 1MBack@3x.png >>

Did I name my image's correctly? What about iPhone 6 - do I name an image for it 1MBack@2x.png or 1MBack-667h@2x.png? It's important to me to get these names right because I sat for quite a while making each asset for each screen and want them utilized accordingly.

One final question: when making the assets in photoshop, as I was sizing them, I choose PPI according to the PPI of the screen the asset would be used on. So the 1x (iPhone 2G, 3G, 3GS) 1MBack.png has a PPI of 163. The 2x (iPhone 4, 4s) 1MBack@2x.png has a PPI of 326. Is this correct? I'm worried about this also, because I read someone writing to make assets in PPI 72. Please clarify this.


回答1:


Set different name for Widescreen images(new iPhones) like name-retina

-(void)didMoveToView:(SKView *)view
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        CGSize result = [[UIScreen mainScreen] bounds].size;
        if (result.height == 480) {//Old iPhone detected
        SKSpriteNode *bg = [SKSpriteNode spriteNodeWithImageNamed:@"1MBack"];//2G, 3G, 3GS
        //By the way you have to set different sprite position for devices here   
        }else{//New iPhone detected
        SKSpriteNode *bg = [SKSpriteNode spriteNodeWithImageNamed:@"1MBack-retina"];//5, 5S, 6, 6Plus
        }
    }
}


来源:https://stackoverflow.com/questions/26721291/sprite-kit-art-assets-naming-convention

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!