# Construction Part of The Game

- Author:
- farâzî

This chapter includes some information about building the game.Firstly, we construct a button which is button1 in the name of "Click To Change Fractions". As it is understood from its name, it provides us to change compared fractions. To change fractions when we click button1, we define 4 variables as a,b,c, and d all together in the same script. For that, we write codes on scripting part of button1 by clinking right and choosing properties tool on button1.And also, we write the codes on "On Clincking", because we want to change fractions when we clink the button1 simultaneously.Thanks to coding, we specify intervals of these variables. For example, we write codes of a=RandomBetween(1, b-1) and b=RandomBetween(2, 20) in this way. We repeat same procedure for c and d. After that, we write fractions on steps part which is next to tools. Then, as we drag the fractions on the page, they occur on the page, too. In addition, they change at the same time when we click the button1.
Now, we have two fractions as Fraction1 and Fraction2. We create three buttons for answers. For the button2, we select button tool then we give a name to caption as "Fraction1 < Fraction2".Then we write codes for button2 in Geogebra Script.
If(Fraction1<Fraction2, SetColor(button2,green))
If(Fraction1>Fraction2, SetColor(button2, red))
If(Fraction1==Fraction2, SetColor(button2, red))
We repeat same steps for button3 and button 4.
We write "Fraction1=Fraction2" on caption part by selecting button from tools .We write the codes on Geogebra Script for button3 are like below:
If(Fraction1==Fraction2, SetColor(button3, green))
If(Fraction1<Fraction2, SetColor(button3, red))
If(Fraction1>Fraction2, SetColor(button3, red))
We write "Fraction1>Fraction2" on caption part by selecting button from tools .We write the codes on Geogebra Script for button4 are like below:
If(Fraction1>Fraction2, SetColor(button4, green))
If(Fraction1==Fraction2, SetColor(button4, red))
If(Fraction1<Fraction2, SetColor(button4, red))
We aim with these codes to see green when players choose right answer and to see red when players choose wrong answer.And also we want to change the colors of buttons to black as fractions change when we clink the button 1,"Clink To Change Fractions". For that, we write codes on scripting part and on clinking of button1. Everytime, we click to see all button in black, we write codes below:
SetColor(button2, black)
SetColor(button3, black)
SetColor(button4, black)
Then, to make an explanation about the functions of buttons, we write a note from text tool.We write "Click the button you think it is right answer". Then, to make clear what is green or red on button, we add a picture from image tool giving feedback as green:right or red:wrong.

## New Resources

Download our apps here: