Help Zooming In/Out
Hi everyone, i'm making a world map for my game, and i've been trying to make a zoom and zoom out behavior. I gave it some tries, but it never works.
These are the behavior i tried:
Rule if touch is pressed, attribute Scene.Camera.Size.Width >= 3840, attribute Scene.Camera.Size.Length >= 2560;
Change Attribute scene.Camera.Size.Width to 480
Change Attribute scene.Camera.Size.Length to 320
Change Attribute scene.Camera.Origin.X to Game.Touches.Touch 1.X - 240
Change Attribute scene.Camera.Origin.Y to Game.Touches.Touch 1.Y - 160
This worked perfectly fine to zoom in, so then i tried another rule to zoom out:
Rule if touch is pressed, attribute Scene.Camera.Size.Width <= 480, attribute Scene.Camera.Size.Length <= 320;
Change Attribute scene.Camera.Size.Width to 3840
Change Attribute scene.Camera.Size.Length to 2560
Change Attribute scene.Camera.Origin.X to 0
Change Attribute scene.Camera.Origin.Y to 0
It makes total sense in my opinion, i just won't understand why, isn't it working. Could someone help?
These are the behavior i tried:
Rule if touch is pressed, attribute Scene.Camera.Size.Width >= 3840, attribute Scene.Camera.Size.Length >= 2560;
Change Attribute scene.Camera.Size.Width to 480
Change Attribute scene.Camera.Size.Length to 320
Change Attribute scene.Camera.Origin.X to Game.Touches.Touch 1.X - 240
Change Attribute scene.Camera.Origin.Y to Game.Touches.Touch 1.Y - 160
This worked perfectly fine to zoom in, so then i tried another rule to zoom out:
Rule if touch is pressed, attribute Scene.Camera.Size.Width <= 480, attribute Scene.Camera.Size.Length <= 320;
Change Attribute scene.Camera.Size.Width to 3840
Change Attribute scene.Camera.Size.Length to 2560
Change Attribute scene.Camera.Origin.X to 0
Change Attribute scene.Camera.Origin.Y to 0
It makes total sense in my opinion, i just won't understand why, isn't it working. Could someone help?
Comments
I can give your example a try in a few minutes, and see if I come up with anything useful. In the meantime, P-O-M has this great mega template that has a pretty solid zoom in it... Perhaps it could be helpful. You can download it in this thread:
http://forums.gamesalad.com/discussion/38132/gs-tool-box-a-free-mega-template-ready-now/p1
I'll get back to you once I give it a go. Good luck!
Ok, that didn't take very long. I'm not sure why your code isn't working, but here's what I did. I made 1 actor, unlocked it, and made these 2 rules...
RULE 1 (Zooms camera out)
When Touch is pressed & scene.Camera.Size.Width=480 & scene.Camera.Size.Height=320
Interpolate (or change attribute) scene.Camera.Size.Width to 3840
Interpolate (or change attribute) scene.Camera.Size.Height to 2560
RULE 2 (Zooms camera in)
When Touch is pressed & scene.Camera.Size.Width=3840 & scene.Camera.Size.Height=2560
Interpolate (or change attribute) scene.Camera.Size.Width to 480
Interpolate (or change attribute) scene.Camera.Size.Height to 320
Let me know if that works for you. If you have any problems with it, let me know and I can upload some screenshots or send you the project file or help you troubleshoot...
Good luck!