Bit maths help

This forum is currently in read-only mode.
From the Asset Store
Here is the wonderful & amazing script for your website or fun with maths.
  • Hi,

    The problem is.

    When I have an Box of

    Height=50

    Width=50

    As It grow's, Then 'text1' one must display an number that not increase(Box.width + Box.Height /4), But instead decrease depending on the box's size.

    Does anyone have the brains to help me with this one?

  • Max number - (Box.Width+Box.Height/4) ?

  • If you don't have a maximum value, create 2 variables.

    1) startvalue = (Box.width + Box.Height /4)

    needs to be calculated when the box is created.

    2) currentvalue = startvalue - ((Box.width + Box.Height /4) - startvalue)

    needs to be calculated whenever the box increases its size. Thi is the value to be shown in the text box.

    Example:

    at start of layout the box is created with 50, 50

    startvalue = 50 + 50 / 4 = 50 + 12.5 = 62.5

    the box grows by 10 pixel in width

    currentvalue = 62.5 - ((60 + 50 / 4) - 62.5) = 62.5 - (72.5 - 62.5) = 62.5 - 10 = 52.5

    box grows again by 10 pixel im height

    currentvalue = 62.5 - ((60 + 60 / 4) - 62.5) = 62.5 - (75 - 62.5) = 62.5 - 12.5 = 50

    etc.

  • tulamide Thanks alot man, Never would have fuger that out by myself!! <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • fuged?

  • You're welcome :)

    fuged?

    No. "to figure out". Like "I never would have figured that out by myself"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)