Squareroot25 - the winning formula

Sunday, July 12, 2009

July 12 2009 Week 14

Name: Wee You

Today, I went back to Level 2 and tried to do up an interface. I did so by creating an empty movie clips and putting all the ingredients inside. I set all of them to invisible and set them to appear whenever the player drops an item into the pot.
There was a problem as the items were all over the place. Hence, I decided to create a function to set the position of the items according to how many ingredients are added. I came up with a formula.

X = I * W
X = the x position desired.

I = Number of ingredients
W = the width between ingredients desired.

However, I referred to the interface and realize that it can only contain 4 ingredients in a row. Therefore, I came up with another formula.

Y = I%4 * H
X = the x position desired.
I = Number of ingredients
H = the height between ingredients desired.

It works!

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home