Home 4 › Forums › iOS / tvOS Starter Kits › The Platform Games iOS and tvOS Starter Kit › Running On iPhoneX
This topic contains 17 replies, has 8 voices, and was last updated by Mario 1 year, 8 months ago.
-
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: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.
-
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" } }
-
-
June 22, 2019 at 4:31 pm #205381
Has anyone been able to get this SideScrollerIOS Kit to work on an iPhone XS or XS Max? I’ve changed the files names to end with “PhoneX”, but all of the scenes still look zoomed in.
-
June 24, 2019 at 5:20 pm #205426
Just updated everything to Swift 5. In the Retro demo and Grassy demo, I added PhoneX.sks labeled files that are sized 2436 by 1125 for the larger phones. When you tried changing the name earlier, did you actually change the size of the scene as well? That might be what you missed doing.
-
-
June 25, 2019 at 5:07 am #205442
Hello,
I add the Phone XR or when you debug load the .phone sks and doesn’t fit the screen.if (UIScreen.main.nativeBounds.width == 2436 || UIScreen.main.nativeBounds.height == 2436 ||
UIScreen.main.nativeBounds.width == 2688 || UIScreen.main.nativeBounds.height == 2688 ||
UIScreen.main.nativeBounds.width == 1792 || UIScreen.main.nativeBounds.height == 1792){
//iPhone XHope help…
-
June 25, 2019 at 5:12 am #205443
the same for Ipad 11 the size is different:
Use .sks “iPADE” for model iPad 11else if (UIDevice.current.userInterfaceIdiom == .pad ){
if (UIScreen.main.nativeBounds.width == 2388 || UIScreen.main.nativeBounds.height == 2388) {
//iPadEprint(“must be iPadE in either portrait or landscape “)
if let _ = GameScene(fileNamed: sksNameToLoad + “PadE”) {
fullSKSNameToLoad = sksNameToLoad + “PadE”
}
else if let _ = GameScene(fileNamed: sksNameToLoad + “Pad”) {fullSKSNameToLoad = sksNameToLoad + “Pad”
}
}
else
//
if let _ = GameScene(fileNamed: sksNameToLoad + “Pad”) {
fullSKSNameToLoad = sksNameToLoad + “Pad”
}
}
-
You must be logged in to reply to this topic.