How do I multiplicate?

0 favourites
  • 10 posts
  • Hey Guys,

    I want to create a Pokemon Go Evolution Simulator. There for i must multiplicate 2 numbers, the multiplicator and a number that the user types in. My question is how can i multiplicat them and put it in the already build sentence.

    dropbox.com/s/y19zqbpfoq7yfam/ad.capx

  • Well the multiplication symbol in C2 is * so you just need to put that into the expression, e.g.

    2 * Variable1

    This will give you the result of Variable1 (which can be your user input) being multiplied by 2.

  • The instance variable Bulbausur in text is updated with Text.Bulbausur*200, as you ask it to do.

    But, you do it on each tick. Wich leads to a infinity number real soon.

    I suppose you meant event 3 to be a SUB-EVENT to event 2. Just drag 3 under 2.

    I also suppose that you wanted to writte the multiplication outcom in the textfield, not in the the Bulbausur variable. So ... Text > set text > str(Text.Bulbausur*200)

    Tip: you can translate the string of the input to a number with: int (CPBox.Text).

    Now the calculation = int(CPBox.Text) * Text.Bulbausur

  • If you gooing to make an instance variable for each multiplicator for each character, thats gonna be a lot of events.

    Suggestion, make a second list holding all the multiplicators in the same order as the characters.

    If you name that second list 'Mult', then the calculation =

    int(CPBox.Text) * int(Mult.ItemTextAt(List.SelectedIndex))

    One line of code for any selection and any value input.

  • Thx for the quick support!

  • If you like me to show you, then make a second list with all multiplicators, post that capx, and i will alter it.

  • If you gooing to make an instance variable for each multiplicator for each character, thats gonna be a lot of events.

    Suggestion, make a second list holding all the multiplicators in the same order as the characters.

    If you name that second list 'Mult', then the calculation =

    int(CPBox.Text) * int(Mult.ItemTextAt(List.SelectedIndex))

    One line of code for any selection and any value input.

    Do you know as well how I can round up the number? 1321.34 to 1321

  • Floor(number) rounds down (1321.34 or 1321.94 = 1321)

    Round(number) rounds to nearest (1321.34 = 1321 and 1321.94 = 1322)

    Ceil(number) rounds up (1321.34 or 1321.94 = 1322)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Floor(number) rounds down (1321.34 or 1321.94 = 1321)

    Round(number) rounds to nearest (1321.34 = 1321 and 1321.94 = 1322)

    Ceil(number) rounds up (1321.34 or 1321.94 = 1322)

    Where should i put this? And whats missing here "with around" str(CPNumber.Zubat*int (CPBox.Text)) "CP" I cant write that

  • Because it is probaly

    str(CPNumber.Zubat*int (CPBox.Text)) & " CP"

    Where you need the number rounded.

    Example : str(floor(CPNumber.Zubat*int (CPBox.Text)))&" CP"

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