Google Classroom
GeoGebraGeoGebra Classroom

Construction Steps

Step 1

  1. Select Toolbar Image to create question. Name it Question.
  2. In scripting part, write "m= RandomBetween(1,25)/RandomBetween(13,50)". (The number are not necessarily have to be these ones. I just wanted to get rational numbers mostly. You can change any number as your wish through this construction steps.) and "b=RandomBetween(-15,15)"
  3. In input bar, write "f: y=mx+b"
  4. In input bar, write "d: y=x". This will be the first players line.
  5. In input bar, write "t: y=x". This will be the second players line.
  6. Hide line d and line t.

Step 2

  1. Click Toolbar Image and then click line f to create random point on f.
  2. Right click on the point, and select settings.
  3. Change its name to "Player"
  4. Againg click Toolbar Image to create another point on the line f.
  5. Right click this new point and again select settings.
  6. Change its name to "Hoop"
  7. In the input bar, write Point(Segment(Player, Hoop)). This will create a point (which will be our ball) between Player and the hoop.

Step 3

  1. Click Toolbar Image under the Toolbar Imageicon, and create a list by drawing a rectangle between Player and Hoop.
  2. Your list should consist of only point Player and point Hoop.
  3. Create another point in f and name it as Hoop'
  4. In input bar write "sHoopPlayer={"SetValue(Hoop', Hoop)", "SetValue(Hoop, Player)", "SetValue(Player,Hoop')"}"
  5. Select your list I1 and go to Settings→Scipting→On Update and write "If(y(Hoop)<=y(Player), Execute(sHoopPlayer))"
  6. Hide the point Hoop'
 In this part, we are now sure that the point Player would never go up the point Hoop.

Step 4

1.   Create a new text by clicking Toolbar Imagebutton and write "First Player". 2.   Drag it to the bottom left of the screen. 3.   Click Toolbar Imageto create an input box and name it "Equation" and linked it line d. 4.   Drag it under the text1. 5.  Again, create a new text and write "Second Player". 6.   Drag this one to the bottom right corner. 7.   Create a second input box and name it Equation too, but linked it line t. 8.   Drag it under the text2. 9.   In input bar, write player1=0 click enter. This will create a slider. 10. Go to slider settings→slider, change its min to 0 and max to 30 11. In ınput bar, write player2=0 and change its settings as player1. 12. Click text bıtton and write "Your score=" and clicked advanced and clicked the GeoGebra icon. Find player1 and select it. Than clicked ok. It should write "Your score = 0". 13. Drag it to the left. 14. Repeat step 12 but instead of selecting player1, select player2. 15. Drag it to the right. 16. Right click on those you have just created and seleck pin to screen, just to be make sure that they are always on the screen and visible.

Step 5

1.   Create a text and write "Basket". 2.   Drag it to the left. 3.   Create another text and again write "Basket". 4.   Drag it to the right. 5.   Check the names of this newly created texts, note them. 6.   Create a button and name it "Fire". 7.   In scripting part write:    
If(f==d,SetValue(text5,"Basket!"),SetValue(text5,"Missed :(")) If(f==t,SetValue(text6,"Basket!"),SetValue(text,6"Missed :(")) If(f==d,SetBackgroundColour(text5,green),SetBackgroundColour(text5, red))      If(f==t,SetBackgroundColour(text6,green),SetBackgroundColour(text6, red)) If(f==d,SetValue(player1,player1+1)) If(f==t,SetValue(player2,player2+1))
 !!Be careful about paranthesis. If your texts has different name than make sure that the first one goes under the first player and second one goes to second player.

Step 6

  1. Insert your ball image by using Toolbar Image button. Make sure that your image is in png format and its background is colorless.
  2. Resize the image as your wish, than look at the length of the bottom side.
  3. Select Toolbar Image and select bottom left corner of the image and write the size you want your ball would be.
  4. Right click the image and go to settings→position. Corner 1 will stay as what it is.
  5. Click corner 2 and select the point you have just created. Now you are sure that your image won't change its size.
  6. Go to input bar and write "C1=Corner(image1,1)" ; "C2=Corner(image1,2)" ; "C3=Corner(image1,3)" and lastly "C4=Corner(image1,4)"
  7. Click Toolbar Image to find midpoint of the image. Then select C1 and C3 or C2 and C4. Name this point CB
  8. Click Toolbar Image to create a vector. Create 2 vectors the that connect the center of the ball to two adiacent corners.
  9. Go to input bar and write CopyFreeObject(image1).
  10. In input bar write "E=A-u" ; "F=A-v" and "G=A+u"
  11. Go to your new image's settings and change position settings to "Corner 1→F" "Corner2→E" and "Corner4→G"
  12. Hide all points you've created and the first image.
  13. Right click the Question button and go to settings→scripting→on click and write "SetCoords(A,x(Player),y(Player))
  14. Right click the Fire button and go to setting→scripting→on click and write   "If(f==d,StartAnimation(A))   If(f==t,StartAnimation(A))"
  15. Now, right click the point A and go to settings→algebra and make speed 2 and in repeat section select "increasing(once)"
now you have just created a ball image that its midpoint connected to line f and goes to start point with every new question. And it animates ball through hoop when the given answer is correct.

Step 7

  1. Find 2 image as your players and find 1 image for your hoop. (I am leaving my images at the bottom. If you want to use them you can copy it . Also the players are my original characters I made in photoshop, so you cant find them anywhere. And if you decided to use your images, you should check its size. If it's big -I mean bigger than 250kb or so- you have to resize it. otherwise GeoGebra online would not save your file. I recommend this site: http://resizeimage.net )
  2. Again, arrange your images at desired size and use segment with given legth tool to make sure they are stable.
  3. Now I want my players to be ready when the new question arrived. So look at your image size and find out it's side lenghts with the help of xy coordinates.
  4. Clicked Question button and go to settings→scripting→on click and write:
    SetCoords(F,x(Player-20),y(Player-40)) SetCoords(G,x(Player-14),y(Player-3.5)) SetCoords(I,x(Hoop-5),y(Hoop-50))
  5. Please be careful about your images. Thise coordinates are appropriate for my images, you can find appropriate sizes for your images after a couple of trials.
  6. Create a new text and write "The Player is at" and in advance settings click geogebra icon and find Player and continue writing "and the Hoop is at" and repeat the steps to find hoop, click ok.
  7. Place the new text under or top of the question button.
  8. Now select one of the images of your player -which you wanted it to be the first one- and right click on it go to settings→advanced and in the Condition to Show Object section write "f!=t" now if the second player makes a mistake, player one will pop up.
  9. Select the other player and again go to settings→advanced and in the Condition to Show Object section write "f!=d"
  10. The game is created now. If you wish, you can add a background image and then its settings you select background, also in advance settings you can arrange its opacity too.

My Background Image

My Background Image

My hoop

My hoop

Player 1

Player 1

Player 2

Player 2