Problem with height increase and constrain
PBEmpire
Member Posts: 676
Hey guys, a problem here.
I have this actor that increases in height each time a button is pressed. However i want the actor to be constrained to the bottom of the scene. I have noticed that gamesalad handles increase height/width in a unusual way- it tops adds height in both ends, instead of just the top. So i have to constrain the actor to the base, if not only half the height will show up. The constrain to position atribute gets jerky here. Help?
I have this actor that increases in height each time a button is pressed. However i want the actor to be constrained to the bottom of the scene. I have noticed that gamesalad handles increase height/width in a unusual way- it tops adds height in both ends, instead of just the top. So i have to constrain the actor to the base, if not only half the height will show up. The constrain to position atribute gets jerky here. Help?
Comments
Hi @PBGames yes, as you've discovered, height and width is added equally (because the x and y position of the actor is in the centre).
So you have to adjust to get what you want: for every move to 2 pixels higher, the centre position needs to be moved 1 pixel lower. Here's a small test to help you:
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thanks for the quick reply. I have found out another method.(This may only work if your actor is the default image-- white bg) In my rules,
When touch is pressed, change attribute- height to height+ (2*game.targetscore)/heightrequire
It also works as it is multiplying the height by 2, so the other half shows up just as required.