Res Independence & Expressions?

ShaneS429ShaneS429 Member Posts: 77
edited November -1 in Working with GS (Mac)
I've been working with GS for about a week now and I've picked it up very well. I'm making my game using the resolution independence and making my images 2x the size for it to upscale with the iPhone 4.

I know that the image and actor sizes will automatically change based on which iPhone is being used, but my question is will expression values change?

I've taken courses in school and the one thing that stuck was that I should NEVER hard code numbers or positions. Everywhere I can, I am using expressions such a self.width and game.display size.height (instead of just 320x480 or what have you), to get accurate placement of actors.

====

Right now I am working on a scrollable background.

I have 2 images on the screen.

When the first background image reaches:
-(game.Display Size.Width/2), which is -240, constrain itself back to game.Display Size.Width + (game.Display Size.Width/2)

And this cycle repeats to cycle the backgrounds as opposed to spawning and destroying new ones.

The problem I'm having is the background images end up being 1 pixel off. If I were to say: Constrain to game.Display Size.Width + (game.Display Size.Width /2) - 1 then this fixes it but then I can see this causing a problem when the pixels double with the iPhone4 as it would have to -2 to shift correctly.

Does the Res Independence scale the formulas and will double that -1 to -2 (I highly doubt it)? Should I create a rule that if game.Display Size.Width = 480 then -1 and if it is 960 then -2?

I've looked over the scrolling background templates and they all seem to hard code in the width and heights of the screen which I don't want to do since it probably wont work right with moving to the iPhone 4 and will make things difficult should I decide to make an iPad version.

Any help is appreciated.

Sorry for being so long winded >.<

Comments

  • ShaneS429ShaneS429 Member Posts: 77
    I figured out the background problem I was having so I won't have to worry about the resolution changes.

    The question still stands however. Will going from 3G/3GS -> 4 double values input into expressions the same way sizes for actors are doubled? Again, I assume it wouldn't be but I just want clarification. I see a lot of the demos on GS and most have hard coded values which can cause problems on different resolutions.
Sign In or Register to comment.