Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm developing a game, and the game has a shop. In that shop there is an option for a house expansion. This is a movieclip that I want the user to be able to spend their coins to increase their house in the following ways:

-> stretch house to right <- stretch house to left ^ stretch house upward v stretch house downward.

The thing is, I've been thinking of using ScaleX and ScaleY to accomplish this. The only problem: It stretches the left and right, I can't make it do one. I'm sure there is a way to do this, but I haven't yet figured it out. Any ideas?

share|improve this question
I figured it out, and I'd like to hear your thoughts on my answer! – Abe Jan 21 at 22:31

2 Answers

Change the registration point of movieclip from "center" to x=0 and y=0 . Keeping the registration point in the center, causes the movieclip to stretch on both the sides equally.

share|improve this answer
+1 Thanks, but I figured it out, until I realized this is also a good method, if I were only trying to do one side. – Abe Jan 22 at 14:03
up vote 0 down vote accepted

Set up the stage:

var num:Number = 10;

Change mc to your MovieClip

For up:

mc.height += num;
mc.y -= num/2;

For down:

mc.height += num;
mc.y += num/2;

For left:

mc.width+=num;
mc.x -= num/2;

For right:

mc.width+=num;
mc.x+=num/2;
share|improve this answer
At least give "num" a proper name ;). Also changing scale depends on your center of origin in the coordinate space of your Movieclip. You should check your own answer so that this question isn't listed as not answered. – Sidar Jan 21 at 22:37
I have to wait 2 days for that, my friend ;) – Abe Jan 21 at 22:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.