Display text center of scene

This is weird and almost shamefully funny!

I just finished a decently complicated game but I can't get a simple display text to show up in the middle of the screen!

My project is in iPad portrait mode.

I have a spawner actor at the bottom of the screen, below the viewable area of the stage.

In the spawner, this is how my code to show the display text looks:

but it does not display the text in the middle... what am I doing wrong?
(the top one is for the first position and the bottom for the second position)

Comments

  • jigglybeanjigglybean Member Posts: 1,584

    Whats the resolution size of your screen? If its the ipad just try 512/384 which is the centre of the ipad screen.

    Like Balls? Then click here! We've 100 coming soon

  • ryastryast Member Posts: 145

    Putting in raw numbers is working fine... but I want to get it to do it automatically (I have a programming background and I prefer not to use hard coded values)

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited February 2015

    @ryast - I'm willing to bet that when you're previewing, you're previewing at 50%. Try previewing at 100%. :)

    The reason for this is that when you preview at 50%, the screen size isn't actually 1024x768 (if you're making iPad game). Obviously, when you publish and test on an actual device, it'll show up in the middle just fine.

  • BBEnkBBEnk Member Posts: 1,764

    It's because game.screen.size still detects original build size of 1024 even if you select iphone5.ETC if you open actor and use scene.camera.size it will work correctly.

  • ryastryast Member Posts: 145

    Braydon_SFX, at half size it does not show me anything, at full size it still is acting goofy, see for yourself:
    cd8ba0b44a15c10065fd-24461f391e20b7336331d5789078af53.r23.cf1.rackcdn.com/gamesalad.vanillaforums.com/editor/cp/p6jeul8vxcx5.zip

    BBEnk, not sure where you mean to change those values :(
    I opened the actor but where do I find scene.camera.size?

  • BBEnkBBEnk Member Posts: 1,764
    edited February 2015

    You should have said you was using my Universal build,lol here I reworked it just a bit for you so you can understand better and changed some notes.

    I also added some new videos to my thread below that have sound and explain things much better.

    http://forums.gamesalad.com/discussion/72589/universal-builds-for-ios-and-android-and-anything-else-using-ipad-build-and-stretch-no-distortion/p1

  • ryastryast Member Posts: 145

    you da man, dude! Will only be using your UB from now on! :) Thanks! Will have a look and write back if it does not sink in!

  • ryastryast Member Posts: 145

    @BBEnk, as promised, am back :p
    Two questions if you dont mind:

    You wrote: "You don’t need a loop if using constraints see my new videos in my Universal Thread."
    I did see your video/s, you said something about Android having a problem if not in a loop...or did I get that wrong and thats no longer a problem so the loop is not needed?

    One of my problems was I was using the prototype instead of using instances... right?

  • BBEnkBBEnk Member Posts: 1,764

    @ryast a loop or a constrain will work you don't need both, I only used loop because I had already built my game using change attributes so I put them in a loop.

    Yes you need a instance to detect device at start and set camera size on scenes.

  • ryastryast Member Posts: 145

    Thanks again BB, have a sunny day :)

  • BBEnkBBEnk Member Posts: 1,764

    Your Welcome.

  • SocksSocks London, UK.Member Posts: 12,822

    @ryast said:
    but it does not display the text in the middle... what am I doing wrong?

    Both Your X and Y positions are set to 'height', the X coordinate should be set to 'width'.

  • ryastryast Member Posts: 145

    Thanks Socks, but I was juggling the values, even when one was set to width and the other to height it didnt work. But BBenk got it sorted so no worries :)

    Cheers!

Sign In or Register to comment.