cocos2d iphone game move to ipad - iphone

i want to make my game universal. but when i try it on ipad, my background layer only covers 1/4 of the screen, but the sprites can go the entire screen. also the sizes of sprites are too small, didn't scale up.
when i see the apple doc, it says i have to "if else" to detect device every time use coordinate. but there are just so much code to be modified.
so is there any way to solve this? like just change in one place?

When you make your game universal, You have to rename your resources to support the ipad size.. meaning : sprite-ipad.png
It is not suppose to scale up when you choose universal app.. You can to redo the sprites..
As cocos2d auto handles the coordinates of the sprites when it is on different devices, it should be all over the device..
If you do not wish to redo the images, you can just choose to build for iphone.. It would be able to scale up when the player downloads it on the ipad..

Related

Sk scene won't fit on iPad?

I'm using sprite kit; my scene won't fit on the iPad, it's like cut off, I've tried everything I know but still can't get it to work. It works fine on all the iPhones but has a problem when it comes to the iPad
The hard work would be to make one .sks file per iPhone/iPad size.
The logic part would to consider what users ""really see" in all devices: 3 to 8
we need to stay at first level imaging : myImage#1x.png
iPhone and iPad scale up and down to fit best to each other
take the smallest screen size and scale it up to fit to bigger devices.
and you will see that there is a rectangle that is always seen in all devices at any scale
all the parts that are off this rectangle, would be the plus parts but non essential to the main part.
this link helps you to do this : https://v-play.net/doc/vplay-different-screen-sizes/

SKScene autolayout adjust to iPhone and iPad

I have created a app using SprikeKit and SKScene, the app runs perfectly on all iPhone simulators however with the iPad simulator, the top is cropped. Is there any settings to have this as an auto layout?
See image attached for GameScene.sks settings
Screenshot
No, SpriteKit does not behave the same as UIKit. It is designed for game development, so an "auto layout" feature is something that would be considered a very low priority to implement since not many games would utilize it outside of an overlay. If you want to make your game appear the same vertically on all devices, then make your scene size a 3:4 aspect ratio. This would mean that cropping will happen on the sides of iPhones.
You could fill in the extra space on the sides with eye candy like bushes so your iPad and iPhone will play the same, but iPad users would just see more.

Cocos2d iphone app runs oddly on actual iphone

I have a simple application using Cocos2d, and all the images show up fine when running on the simulator. However, when i run it on an iphone, all the images are scaled up and incredible amount, making the game unplayable.
Has anyone got any ideas as to why this is happening, and how to fix it?
You need to consider the possibility that your simulator is running retina. Probably you are trying to display an image that is at the higher resolution on an older, non-retina device.
You can also just add the suffix "-hd" to any image, and then cocos2d will recognize it as being at the higher resolution automatically. But when you actually finish your app you will want to have 2 copies of each image, one at each resolution.
I found out that the problem was that when i initialised the sprite, using spriteWithFile, it set it to a certain size. When i changed the sprites texture later on, it kept the size of the last image, but had a different texture.

iPad to iPhone image size/layout confusion

I've written an application for the iPad that I'd now like to get working on the iPhone (a universal application).
At the moment it runs in the iPhone simulator, but the UIKit elements are positioned using pixel positions - so a lot of them are offscreen. Additionally my UIImages are too big, and need to be scaled to fit the iPhone. How do I go about doing this?
Thanks in advance.
Some more information:
If I position a UIImageView using UIBuilder, the image displayed takes up the same ratio of the screen if displayed on the iPad or iPhone. Which is what I want, however I need to do it programatically.
If I create a UIImageView programmatically it will take up a much larger ratio of the screen on the iPhone compared to the iPad.
Edit:
My nib is actually empty apart from a OpenGL view. The OpenGL view is scaling fine.
I do create a few UIKit controls programmatically and this is where the problem is happening.
Probably the easiest way: make two separate xibs (1 for iPad, 1 for iPhone).
Start a new universal project and migrate the curent one into it, it'll take some time, but it'll save you a lot of headaches.

iPhone game display is off the screen by 10 pixels or so on the device

I recently deployed my first iPhone app, a simple game, to my testing iPhone for the first time. Everything looks and runs fine on the simulator in Xcode, but on the iPhone the whole image is shifted up about 10 pixels or so. So the gameplay goes slightly offscreen on top and has a slim white/grey bar at the bottom. Has anyone encountered this before? I do have the status bar display turned off, I'm wondering if the device handles that flag differently than the simulator. I also have the rotation hardcoded to be in portraitRight mode at all times, and I have an extra line in the code to make the simulator do that automatically that's apparently not necessary on the device.
Everything is very simple, so I'm not sure where this glitch is coming from or even where to look.
Did you use Interface Builder to create your UI? If you did, then go and check each and every XIB file(s) objects' Size & Position as well as Autosizing in Size Inspector (command-3).
It's very important to check both: your coordinates might have gone wrong after some change you did and autoscaling works in weird ways unless you attach to correct edges. Apple documentation should help http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html