Pinch to zoom in and out in GS?
MLCinema
Member Posts: 133
Hello All,
Does GS support pinch to zoom in and out? If so, any tutorials?
Thank you.
Does GS support pinch to zoom in and out? If so, any tutorials?
Thank you.
Comments
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Theres some steps on how to zoom the camera in the Unofficial GameSalad Textbook, which is worth buying if you can as it will teach you so much, and its well written....
(edit: its not how to pinch to zoom, but simply how you can zoom the camera even though its not built to do it).
Create an actor
Create self.TouchDistance1 (real), self.TouchDistance2 (real), self.ZoomedOut (boolean)
Then drag it into the scene and unlock it.
Rule- When touch is pressed
------Rule- When touch count = 2
---------Change Attribute Self.TouchDistance1 to magnitude( game.Touches.Touch 1.X - game.Touches.Touch 2.X , game.Touches.Touch 1.Y - game.Touches.Touch 2.Y )
---------Timer Every 0.1 seconds
------------Change Attribute self.TouchDistance2 to magnitude( game.Touches.Touch 1.X - game.Touches.Touch 2.X , game.Touches.Touch 1.Y - game.Touches.Touch 2.Y )
-------Rule - When self.TouchDistance2 is > self.TouchDistance1*1.4
------------Change self.ZoomedOut to 0
-------Rule - When self.TouchDistance2 is < self.TouchDistance*0.6
------------Change self.ZoomedOu to 1
Rule - When self.ZoomedOut is true
----Interpolate camera width to ??? (something bigger than 480)
----Interpolate camera heigth to ??? (something bigger than 320 but make sure you proportions are correct)
OTHERWISE
----Interpolate camera width to 480
----Interpolate camera heigth to 320
I've tried out your method for pinch/zoom (great work by the way), but I've found that my UI elements also shrink/grow even though they are on a separate non-scrollable layer. Is there a way around this or does zooming the camera just affect all actors no matter what layer they are on?
See the other topic to download source and read explaination:
http://gamesalad.com/forums/topic.php?id=14216