Result of math problem in string

0 favourites
  • 3 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • Hoping someone can help me out on what seems to be a simple problem.

    I'm making a simple math game for kids and want to have a problem display and the answer in a random location. I figured it would be as easy as doing

    question text string:

    int(random(0,20))&"+"&int(random(0,20))

    then a correct answer text string

    int(question.TEXT)

    Question displays fine but the answer only shows the first integer. How can I convert the entire string so that it gives the result?

    I thought about making two sets of variables which could be put together in the question and then added together for the answer but this seems like it would become overly complicated as I start adding levels with other operands, carrying and the like.

  • I had made this example a long time ago.

    At the time functions weren't yet implemented in C2, but this example should still work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Great!

    Seems like there should be a simpler way but it certainly helps to look though what you've done.

    My seven year old son will be thrilled as well. The whole design of this game was his idea. I'll post it later. :)

    Thanks.

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