New Universal Build Method: iPhone 4 & iPhone 5
VoidedSky
Member Posts: 1,095
Hey all!
I was working on my game, and checking out the new Universal Binary stuff. I saw Darren's method of adjusting the camera, and I messed around with that, but I didn't like how the images stretch. So, I came up with my own method. All you do is drag the code into each actor in the scene, and it re-adjusts the size and position of the actors based on the screen size. What I have in my demo, is as follows: The scene is made for iPhone 5, and it re-adjusts for the iPhone 4. You can mess around a little with the code to make it do the opposite, and you can probably make a version to convert games to iPad resolution. But right now, all it is, is for iPhone 4 and iPhone 5.
iPhone 5
iPhone 4
What the code does, is finds where the actor is relative to the screen, and recreates its position in the new screen size. So basically, it is using its percent of the location on the screen. The code also resizes the actor, so it is the same relative to the other actors in the scene. For example: You have a platformer game, and you have two blocks right next to each other, not overlapping, and with no space in between them. If you just resized the scene from iPhone 5 to iPhone 4, the actors would then overlap. Respectively, if you made the scene for iPhone 4 and converted it to iPhone 5, there would be a gap between the two actors. The resizing of the actors fixes this problem. The actors are smaller, but they are in the correct spot relative to each other.
You can get more info on my site Here
You can also download it below
I hope this at least helps some people!
~Josh
I was working on my game, and checking out the new Universal Binary stuff. I saw Darren's method of adjusting the camera, and I messed around with that, but I didn't like how the images stretch. So, I came up with my own method. All you do is drag the code into each actor in the scene, and it re-adjusts the size and position of the actors based on the screen size. What I have in my demo, is as follows: The scene is made for iPhone 5, and it re-adjusts for the iPhone 4. You can mess around a little with the code to make it do the opposite, and you can probably make a version to convert games to iPad resolution. But right now, all it is, is for iPhone 4 and iPhone 5.
iPhone 5
iPhone 4
What the code does, is finds where the actor is relative to the screen, and recreates its position in the new screen size. So basically, it is using its percent of the location on the screen. The code also resizes the actor, so it is the same relative to the other actors in the scene. For example: You have a platformer game, and you have two blocks right next to each other, not overlapping, and with no space in between them. If you just resized the scene from iPhone 5 to iPhone 4, the actors would then overlap. Respectively, if you made the scene for iPhone 4 and converted it to iPhone 5, there would be a gap between the two actors. The resizing of the actors fixes this problem. The actors are smaller, but they are in the correct spot relative to each other.
You can get more info on my site Here
You can also download it below
I hope this at least helps some people!
~Josh
Comments
~Josh
The problem is when you preload art before the scene.
I`m testing on xcode my app, and loads and resize it perfectly on ipad, i4 and i5, and on real device too.
But, i have published and send it to apple, and is rejected because one map is out of scene on iPhone 5.
There is something that is changed when i publish my app. Some check or i don't know how my game project works fine on xcode and real device, but not when i publish.
You have do it: is game.screen=480 do selfsizewidth*number.
You can get that number automatically on each device like this:
mygamescreen/gamescreenproject=numer
All devices do: game.screen=game.screen*number
~Josh
Yep, you should be able to. You would just have to switch the X and Y attributes.
~Josh
Thanks a lot in advance!
how to switch the X and Y attributes? i figure out but can't work
can you do portrait version to me?thx
Good Luck!
~Josh
thx ur help
~Josh
Hey,
can you send me the demo adjusted for iPad portrait? I tried to change the attributes but it seems not to work.
Thanks a lot!
Ok, it works with actors, but what about a background? The only thing which doesn't work here ..Thanks!
Cheers.
Are you going from iPad to iPhone? I so, you will either have to stretch your background, or figure out a different size that will work for it. And I can figure up a portrait version for you soon (will probably be tomorrow)
@LeonardDeveloper
Are the rules not working? What are you tryin to conver to and from? It might be the attribute "change" which you don't need. That was for demo purposes. You may delete that behavior. Let me know if things still aren't working...
Thanks so much!
Here is the Portrait version
Thanks a lot but there is a problem. It does not correctly resize a background. I have the background 768x1024 in the iPad project and it looks like cut in terms of height when I preview on the GS viewer on my iPhone 5.
Ideas?
Is there a smiley for stinking?
Got that problem sorted
Now found a new issue - All works, Except I have a background & A rotating sunburst.... Both of those just wont fit the screen no matter what, Any ideas?
(Sorry for double post)
i5 is first image,
i4 is second
Movable unchecked... ETC ETC
look i heard that Apple want all app to fit on legacy iPhones and iphone 5
so in my app i make everything to fit exactly to iphone 5 and then i used your code and now it fit to legacy iphones too...so now when i publish the app Apple will approve it???
For the background, have it reposition its location, but not change it's size. Let me know if this helps.
@nir3112
Yes, it should be approved, provided everything else meets their guidelines.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS