@strag I haven't fully tested Lovejoy's formula but game.Display.Size.Height might be a better choice as it is the height measurement of the display the game is written in, in this case iPad. If you don't get the same results without this bit of code just experiment with it.
The min() max() combo is a handy little equation which can be used in lots of situations. They just pick the min or max of two numbers. In this configuration it will always be 1 or -1 which multiplies the remainder of the formula changing it to either a positive or negative so you don't have to hard code it each time.
@colander
Just been testing this on a portrait build and it's working fine: Self.Position.X+max(min(game.Screen.Size.Width/2-Self.Position.X,1),-1)*abs((((game.Screen.Size.Width *1024)/game.Screen.Size.Height)-768)/2)
hi guys this formula works very good, the only problem i have is on Android when I first start up my game the positioning doesn't work but when i click to the level select menu of the game and then go back to the main screen it works fine its only literally on the start up only ever other scene no issues. any ideas on how to fix this for android?
@paulkerry said:
hi guys this formula works very good, the only problem i have is on Android when I first start up my game the positioning doesn't work but when i click to the level select menu of the game and then go back to the main screen it works fine its only literally on the start up only ever other scene no issues. any ideas on how to fix this for android?
Gamesalad is a bit slow to detect screen size on Android. You can fix this by switching from "change attribute" to "constrain attribute" and changing the self.position Y in the expression to the Y position that you have placed the actor on the scene.
Hi thanks for the reply what do you mean by the second part of your comment with the position Y change? also can this formula also adjust for Ad banners?
@paulkerry said:
Hi thanks for the reply what do you mean by the second part of your comment with the position Y change? also can this formula also adjust for Ad banners?
In the expression, theres an attribute self.position Y. Replace that with the actual position that the actor is placed on the scene. For example: if the actors Y position on the scene is 650, put 650 in the place of self.position Y in the expression.
Ad banners always display at the very top, or very bottom of the screen.
Comments
@strag I haven't fully tested Lovejoy's formula but game.Display.Size.Height might be a better choice as it is the height measurement of the display the game is written in, in this case iPad. If you don't get the same results without this bit of code just experiment with it.
The min() max() combo is a handy little equation which can be used in lots of situations. They just pick the min or max of two numbers. In this configuration it will always be 1 or -1 which multiplies the remainder of the formula changing it to either a positive or negative so you don't have to hard code it each time.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander
Just been testing this on a portrait build and it's working fine: Self.Position.X+max(min(game.Screen.Size.Width/2-Self.Position.X,1),-1)*abs((((game.Screen.Size.Width *1024)/game.Screen.Size.Height)-768)/2)
hi guys this formula works very good, the only problem i have is on Android when I first start up my game the positioning doesn't work but when i click to the level select menu of the game and then go back to the main screen it works fine its only literally on the start up only ever other scene no issues. any ideas on how to fix this for android?
Gamesalad is a bit slow to detect screen size on Android. You can fix this by switching from "change attribute" to "constrain attribute" and changing the self.position Y in the expression to the Y position that you have placed the actor on the scene.
Mental Donkey Games
Website - Facebook - Twitter
Hi thanks for the reply what do you mean by the second part of your comment with the position Y change? also can this formula also adjust for Ad banners?
In the expression, theres an attribute self.position Y. Replace that with the actual position that the actor is placed on the scene. For example: if the actors Y position on the scene is 650, put 650 in the place of self.position Y in the expression.
Ad banners always display at the very top, or very bottom of the screen.
Mental Donkey Games
Website - Facebook - Twitter