Running On iPhoneX

This topic contains 11 replies, has 6 voices, and was last updated by  Johnathon 1 month ago.

  • April 1, 2018 at 6:44 pm #182563

    I might be completely overlooking something, but how would I go about scaling this kit to work on iPhoneX?

    Thanks.

  • April 1, 2018 at 10:14 pm #182568

    Hopefully you don’t need to change it at all. Its a pain to duplicate an entire SKS file just for an alternate iPhone. And since platform games are oriented sideways, most likely your GUI is just going to be centered anyway. So on the iPhoneX you should just be seeing some extra portion of the screen on the sides. But if you want to make a custom SKS file just for the X, lemme know.

    • April 2, 2018 at 5:17 pm #182612

      This is what I get when I run the game on an iPhoneX.

      iPhoneX Screenshot

  • April 2, 2018 at 5:31 pm #182613

    Screenshot didn’t post. But redownload the kit and just update the 4 most recent .swift files. You can create an sks file with the postfix “PhoneX” and make a custom sks file just for that device. Same thing you do when making an sks file for the other device families

  • April 20, 2018 at 1:14 am #183153

    Hi Justin, Joe

    According to this discussion, are you suggesting that we update each device .sks separately for each level? It seems like doing the same thing 3-4 times. What is the most efficient and fastest way to build levels for each device?
    1) Copy (duplicate) existing .sks and adjust it for the additional device?
    OR
    2) Recreate level in sks for each device based on what is already made in RPG template?
    or maybe i am missing something.

    Thank you!

  • April 28, 2018 at 3:36 pm #183455

    Hello Justin, Joe and Universe

    I have created sks files for my home/level menus and when I load them on the simulator to test on the iPhone X my home menu loads fine but my level menu doesn’t, then when I go back to the home menu it loads the iPhone screen.

    How would I fix this problem?

    It’s faster to duplicate your levels then adjust them to the current device that your are working on.

    • April 29, 2018 at 10:53 pm #183474

      You named it Level1PhoneX.sks ? The 1 is definitely in there.

  • March 17, 2019 at 4:23 am #204104

    Did you guys get the maps looking correct? The demos currently load ‘zoomed in’.
    It looks fine on the 6s but on X/Xr etc the scaling is incorrect.
    Is the Main.Storyboard the overriding factor or is it hard coded for sizing?

  • March 18, 2019 at 9:24 am #204127

    Nah, don’t touch the Main.storyboard. SpriteKit won’t like that. If you want an X sized alternative scene, name the .sks with PhoneX for example, MapsPhoneX.sks and then you can size that to be the right ratio. 812 by 375, or a factor upwards from that.

    What the code is doing is checking the nativeBounds.height and .width for certain sizes, and you can search the code for “PhoneX” to pull up all the places where it makes that check. For example…

    if (UIScreen.main.nativeBounds.width == 2436 || 
    
    UIScreen.main.nativeBounds.height == 2436 || 
    
    UIScreen.main.nativeBounds.width == 2688 || 
    
    UIScreen.main.nativeBounds.height == 2688) {

    So if there was some size in the future we need to add, it would go there. (there’s a couple places where that appears).

    • March 23, 2019 at 1:51 pm #204211

      So Im trying to add more sizes for the new XR and Im getting some errors. Below is the code that Ive got, maybe Im doing something wrong that’s not clicking with me.

                  if (UIScreen.main.nativeBounds.width == 2436 || UIScreen.main.nativeBounds.height == 2436 || UIScreen.main.nativeBounds.width == 2688 || UIScreen.main.nativeBounds.height == 2688) {
                      //iPhone X
                      
                      print("must be iPhone X in either portrait or landscape ")
                      
                      if let _ = GameScene(fileNamed:  sksNameToLoad + "PhoneX"){
                          
                          fullSKSNameToLoad = sksNameToLoad + "PhoneX"
                          
                      }
                      else if let _ = GameScene(fileNamed:  sksNameToLoad + "Phone"){
                          
                          //on iPhone X but there's no PhoneX sks, still should check for a Phone sks
                          
                          fullSKSNameToLoad = sksNameToLoad + "Phone"
                          
                      }
                      
                      if (UIScreen.main.nativeBounds.width == 1792 || UIScreen.main.nativeBounds.height == 1792 || UIScreen.main.nativeBounds.width == 828 || UIScreen.main.nativeBounds.height == 828) {
                          //iPhone XR
                          
                          print("must be iPhone XR in either portrait or landscape ")
                          
                          if let _ = GameScene(fileNamed:  sksNameToLoad + "PhoneXR"){
                              
                              fullSKSNameToLoad = sksNameToLoad + "PhoneXR"
                              
                          }
                              
                          else if let _ = GameScene(fileNamed:  sksNameToLoad + "Phone"){
                              
                              //on iPhone XR but there's no PhoneXR sks, still should check for a Phone sks
                              
                              fullSKSNameToLoad = sksNameToLoad + "Phone"
                              
                          }
                      
                      
                      
                  }
                      
                  else if let _ = GameScene(fileNamed: sksNameToLoad + "Phone") {
                      
                      fullSKSNameToLoad = sksNameToLoad + "Phone"
                      
                  }
              }
    • March 25, 2019 at 3:29 pm #204241

      I am having a similar issue, what is did you set the skscene size to?

You must be logged in to reply to this topic.




Become part of the CartoonSmart Team with our Affiliate Program

Make recurring money when you refer a subscriber. 30 day tracking. Commissions 33%-50%!


Uh oh, missing your affiliate ID. Create one real quick