Be a Supporter!

Help with a scripting issue

  • 241 Views
  • 7 Replies
New Topic Respond to this Topic
bikinigames
bikinigames
  • Member since: Aug. 26, 2011
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Help with a scripting issue 2011-08-27 19:14:39 Reply

Alright so there's a sort of a "zoom" feature in my game that is controlled by manipulating _root._xscale and _root._yscale and works great. My problem is that I want my menus and other elements to remain 100% scaled even when _root._xscale and _root._yscale isn't 100%.

For example when _root._xscale = 50, I want menu._xscale = 200, etc.

Hope someone here can help!

Deadclever23
Deadclever23
  • Member since: Nov. 27, 2006
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to Help with a scripting issue 2011-08-27 19:26:47 Reply

Put all your game elements in one movieclip and your UI in another and then just scale the movieclip with the game elements in.


"To live is the rarest thing in the world. Most people exist, that is all."
- Oscar Wilde

BBS Signature
bikinigames
bikinigames
  • Member since: Aug. 26, 2011
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Help with a scripting issue 2011-08-27 19:31:11 Reply

At 8/27/11 07:26 PM, Deadclever23 wrote: Put all your game elements in one movieclip and your UI in another and then just scale the movieclip with the game elements in.

Thank you for the response but that would all be incredibly impractical at this stage of the game. I believe the code should be super simple and would completely remedy the situation, I just can't wrap my brain around the logic. :/

Deadclever23
Deadclever23
  • Member since: Nov. 27, 2006
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to Help with a scripting issue 2011-08-27 19:36:45 Reply

Plan ahead next time.


"To live is the rarest thing in the world. Most people exist, that is all."
- Oscar Wilde

BBS Signature
bikinigames
bikinigames
  • Member since: Aug. 26, 2011
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Help with a scripting issue 2011-08-27 19:46:56 Reply

I appreciate your suggestions but I'm looking for one more suitable to my current situation. I suggested the logic that I believe would be most effective in my first post.

Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to Help with a scripting issue 2011-08-27 19:57:27 Reply

It is much easier put every movie clip you would like to zoom into an array and iterate the scale, like this:

var things:Array=[mc1,mc2,mc3,mc4,mc5];

function onEnterFrame():Void
{
      for(var i:Number=0;i<things.length;i++)
      {
              things[i]._xscale=things[i]._yscale=50;
      }
}
Sandremss128
Sandremss128
  • Member since: Aug. 22, 2009
  • Offline.
Forum Stats
Supporter
Level 11
Programmer
Response to Help with a scripting issue 2011-08-27 20:14:18 Reply

At 8/27/11 07:46 PM, bikinigames wrote: I'm looking for one more suitable to my current situation.

There is no tomorrow, just find the fix you need right now and if you ever find the urge to take a crap: do it in your pants because going to the toilet is working on tomorrow.

At 8/27/11 07:36 PM, Deadclever23 wrote: Plan ahead next time.

See? this guy knows what he's talking about! no shit in his pants
God I need a beer..

boney-man
boney-man
  • Member since: Jul. 24, 2005
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Help with a scripting issue 2011-08-27 22:20:29 Reply

At 8/27/11 07:57 PM, Spysociety wrote: It is much easier put every movie clip you would like to zoom into an array and iterate the scale, like this:

var things:Array=[mc1,mc2,mc3,mc4,mc5];

function onEnterFrame():Void
{
for(var i:Number=0;i<things.length;i++)
{
things[i]._xscale=things[i]._yscale=50;
}
}

That won't keep the movie clips in the same apparent position relative to each other.
To the OP, you really should have planned ahead.


#1286129 // soundcloud.com/1shibumi

BBS Signature