Scaling Camera to make zoom, how do I stop the Non scrolling/HUD items zooming?
StormyStudio
United KingdomMember Posts: 3,989
Good evening.
Ok, I have a point where I have the camera in my game scale to half its original size on the x and y, to create a zoom effect. It works really well, except my Menu items/buttons which are also on the screen at the same time scale with the camera even though they are non scrolling layers.
Whats the best way to combat this?
Do I have to scale each of the other items to compensate the camera scale?, will this screw with their positions as it zooms, so do I need to take into account some sort of offset, or is it fine as they're non scrolling items.
Any one come across and solved this problem?
You can see what I'm talking about at 57 seconds, in the below video, my tool box button is scaling up when ideally it would not...(also affects the rest of the menu when its rolled out).
See it at 57 seconds in:
Ok, I have a point where I have the camera in my game scale to half its original size on the x and y, to create a zoom effect. It works really well, except my Menu items/buttons which are also on the screen at the same time scale with the camera even though they are non scrolling layers.
Whats the best way to combat this?
Do I have to scale each of the other items to compensate the camera scale?, will this screw with their positions as it zooms, so do I need to take into account some sort of offset, or is it fine as they're non scrolling items.
Any one come across and solved this problem?
You can see what I'm talking about at 57 seconds, in the below video, my tool box button is scaling up when ideally it would not...(also affects the rest of the menu when its rolled out).
See it at 57 seconds in:
Comments
Shame you can't select affected layers when using something like the camera zoom.
Darren.
I really wish GS would fix the way zooming works. It is such a pain!
EDIT: After you do all that it still won't work because the touch zone does not follow the actor. So I had to create a touch1 actor that constrains to touch1 X and Y with the ratio and the camera origin offset and check if this is overlapping and touch count >0 instead of touch is pressed. SUCKS!
Changing the alpha, or animating the items off screen seems like the best bet then.
Thanks for the reply,
and as SciTunes says I hope GS sort this out in the future, as the ability to zoom is such a nice one.
Create two Game Atts (CameraH and CameraW) for example and constrain them to the camera size in the scene. Then constrain each actor in the scene that needs scaling to the Global Att and divide it by X ( game.cameraH / 3 ) for example.
The bit I struggling with at the moment as I haven't had much time to think about it (never have kids). Is how constrain their position on the screen relative to the camera zoom?
I played with various methods for the zoom in Mole in a Hole, and opted for turning the HUD elements transparent when the zoom kicked in. It looks ok... but not the most ideal situation.
Like Darren said, would be good if we could have more control of layers regarding zoom/camera controls etc....
I want to avoid as many constraint behaviors as possible...
you can use width or height for computing the zoomFactor, i used width, I'm assuming your camera maintains aspect ratio and the width and height don't stretch the image.
Constrain zoomFactor = cameraWidth / displayWidth
Constrain HUDObject.width = desiredWidth * zoomFactor
Constrain HUDObject.height = desiredHeight * zoomFactor
Bingo, done.
For more info about positioning things with a zoomed camera see my example under my profile: Camera to World Coordinates
http://gamesalad.com/game/3220
Edit: I just noticed that the GS website is borked and doesn't display the directions anymore. Anyhow, arrowkeys zoom in and out. Click to move the yellow rect to wherever you click regardless of zoom factor. coordinates are calculated for you.
but, you can enclose the Display Text in a Rule to respond to a gameAttribute which will determine if it is visible...
EX: [Rule] when game.Zoom = false (zoom not active therefore you want the Display Text visible)
--Display Text
then if the Zoom is true nothing will show in the actor
MH