Background image size Sprite Kit Game

后端 未结 9 1841
一生所求
一生所求 2020-12-23 09:51

i just started a new Sprite Kit project to learn how to use it. I watched and read a lot of tutorials but no tutorial has a answer for my question/problem.

I want to

相关标签:
9条回答
  • 2020-12-23 10:47

    Have you tried adding "@2x" to the end of the name of your image?

    0 讨论(0)
  • 2020-12-23 10:51

    I did use and sprite for background.

        double escalax =        self.size.width/ sprite.size.width  ;
        double escalay =        self.size.height/ sprite.size.height  ;
    
    
        SKAction *mostrar = [SKAction scaleXTo:escalax y:escalay duration:0];
    

    Hope it helps!

    0 讨论(0)
  • 2020-12-23 10:56

    This worked for me. Is this ok to do?

    //Set background image.
        SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"myBackground.png"];
        background.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
        background.xScale = 0.5;
        background.yScale = 0.5;
    
        [self addChild:background];
    
    0 讨论(0)
提交回复
热议问题