Help Zooming In/Out

007leokart007leokart Member Posts: 38
edited July 2012 in Working with GS (Mac)
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?

Comments

  • ericzingelerericzingeler Member Posts: 334
    So you have one button with two zoom states. Is this correct?
  • 007leokart007leokart Member Posts: 38
    Actually, there is only one actor in the whole game, so the zoom in and out behaviors are all in that actor.
  • 007leokart007leokart Member Posts: 38
    Does anyone have a solution?
  • ekelrockekelrock Member Posts: 34
    @007leokart

    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!
  • 007leokart007leokart Member Posts: 38
    edited July 2012
    Thanks a lot ekelrock, i'll see teh P-O-M mega template.
  • ekelrockekelrock Member Posts: 34
    edited July 2012
    @007leokart
    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!
  • 007leokart007leokart Member Posts: 38
    YESS!!! It finally worked!! THANKS A LOT ekelrock!!
  • ekelrockekelrock Member Posts: 34
    No problem, good luck on the game!
Sign In or Register to comment.