How do I Fix/Finish what I've started (Scratching my head)

0 favourites
  • 9 posts
From the Asset Store
Just kick the ball with your head and score against the other team!
  • HungryNoob here

    Hey Guys, Need some help fixing some programming for a simple math capx, I have 3 questions pertaining to the capx file, the questions are included in the capx. I've tried a few things but being that im just learning the ropes im in need of a little help. :-/

    example capx attached. would greatly appreciate it.

    Thanks Guys

    HungryNoob413

  • Anybody?

  • 1. Should be fairly easy. Since you know the answer before hand and even if you generate it. You can have two variables one for each number. So if the basic setup is "A + B = C"

    Then you can store a random number in "A" and "B"

    And then you just:

    "Pick random <Answer box>"

    (in a variable you store the correct answer, for instant in something called "Result" and then make a Boolean as well, that will allow you to see if an <Answerbox> have been given a result, and one to mark it as the correct answer)

    "Set <Answerbox>.result = A+B"

    "Set <Answer box>.text = <Answerbox>.result"

    "Set <Answerbox>.Have_result = True"

    "Set <Answerbox>.Correct_answer = True"

    For the others you can just check to see if there is already stored a result.

    <Answerbox>.Have_result = False

    For each <Answerbox>

    "Set <Answerbox>.Result = int(Random(50) + 1)"

    "Set <Answer box>.text = <Answerbox>.result"

    "Set <Answerbox>.Have_result = True"

    "Set <Answerbox>.Correct_answer = False"

    Then you can just check if the player have selected the right one. And use the result to show the player that it was correct or remove it and just write correct, whatever you need.

    2. Can be done with a button where you do it all over again or you can hook it up to a timer that will make it do it again after a certain amount of time.

    3. To make sure that the first number is always higher, you can just generate the second number first, and add another random to it.

    "Set <First number> = <Second number> + int(random(10)+1)"

  • Do you mind doing that in the capx file iv attached to tge original message? That way I can study it, and see it in action. Would appreciate it. Excuse my noobness

    Thanks

  • Looking at your program, ill rather not. Because I would not do it like you have done it. Meaning I would pretty much have to make it from scratch. Which I don't think would benefit you a lot, as the moment you have to expand it, you would have to agree/understand the way I did it.

  • nimos100 You welcomed do it your way, I got that code from the forums but was stuck with the things in questions, but if you could do it your way i would study it and break it down to start unddrstanding it. Either way thanks for your help. Its appreciated.

  • Here is a working game.

    It only uses + and - but extending it shouldn't be a problem.

    [attachment=0:3a02up90][/attachment:3a02up90]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sweet nimos100 ill take a look now , Thanks for the help!

  • Np

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