New Universal Build Method: iPhone 4 & iPhone 5

VoidedSkyVoidedSky Member Posts: 1,095
edited February 2013 in Working with GS (Mac)
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

image


iPhone 4

image


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
«13

Comments

  • VoidedSkyVoidedSky Member Posts: 1,095
    Been seeing some more posts come across about over scanning and universal binaries, so I thought I'd give this a little bump for some people to see.
    :)

    ~Josh
  • mrpacogpmrpacogp Member Posts: 400
    edited February 2013
    I have one like that but for all, resized to iPad or any size of screen.
    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
  • VoidedSkyVoidedSky Member Posts: 1,095
    That's odd, have you tried making a development version of your app and installing it on your iDevices? If so, did it work?

    ~Josh
  • wolala123wolala123 Member Posts: 249
    edited March 2013
    it can use in portrait too?or landscape only?thx
  • VoidedSkyVoidedSky Member Posts: 1,095
    @wolala123
    Yep, you should be able to. You would just have to switch the X and Y attributes.

    ~Josh

  • bigbenolibigbenoli Member Posts: 12
    I have one like that but for all, resized to iPad or any size of screen.
    @mrpacogp can you please share your solution like @voidedsky did?
    Thanks a lot in advance!
  • wolala123wolala123 Member Posts: 249
    @VoidedSky
    how to switch the X and Y attributes? i figure out but can't work
    can you do portrait version to me?thx :)
  • VoidedSkyVoidedSky Member Posts: 1,095
    Here is the portrait version.
    Good Luck!

    ~Josh
  • wolala123wolala123 Member Posts: 249
    @VoidedSky
    thx ur help
  • VoidedSkyVoidedSky Member Posts: 1,095
    Here is a project which converts to iPhone 4 and iPhone 5 from an iPad project.

    ~Josh
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    @VoidedSky

    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!
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    @VoidedSky

    Ok, it works with actors, but what about a background? The only thing which doesn't work here ..Thanks!
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    edited May 2013
    Just get the message - When transferring to new actors, Any ideas?
    image
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Has anyone a proper method to go from iPad to iPhone 4 and 5?

    Cheers.
  • VoidedSkyVoidedSky Member Posts: 1,095
    @GuaveGames

    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...
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    edited May 2013
    That would be awesome @VoidedSky

    Thanks so much!
  • VoidedSkyVoidedSky Member Posts: 1,095
    @GuaveGames

    Here is the Portrait version
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    @VoidedSky

    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?
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    @GuaveGames Don't do it in the viewer. It stinks. Make an Ad Hoc build.
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    edited May 2013
    Haha I figured it out on the viewer. You need to turn off the change self.height rule.

    Is there a smiley for stinking? :D
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    edited May 2013
    @voidedsky
    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?
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    edited May 2013
    E.G) Just made a quick demo project for reference
    (Sorry for double post)
    i5 is first image,
    i4 is second
    Movable unchecked... ETC ETC
  • nir3112nir3112 Member, PRO Posts: 316
    thx a lotttt bro!! its working perfect!!!!
    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???
  • VoidedSkyVoidedSky Member Posts: 1,095
    @Leonard Developer
    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. :)
  • iprasadiprasad Member Posts: 40
    @VoidedSky Can you post a project w/ the scripts detailing how to resize from iPhone 5 to iPad?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I worked out an interesting camera trick to resize Puck It taking it from IPad to IPhone legacy and iPhone 5. When I have a chance I'll do a video. It does require adding touch offsets for any actor that follows the mouse position but all other general touch is pressed non movables need no adjustment.
  • dwibredwibre Member Posts: 192
    What do you think about mine @FryingBaconStudios built for iphone 5 but I want to resize for ipad? Is it a compleate rebuild?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I know @tenerdrmr said his method works for iPad upsize and meets the retina requirement. I don't usually work that way as I always start with an iPad project even before the new Apple requirements. So I couldn't factually say.
  • dwibredwibre Member Posts: 192
    whos @tenerdmr the link does not find a person?
  • dwibredwibre Member Posts: 192
    Dont worry found @tenrdrmer
Sign In or Register to comment.