Construction Steps

Step 1
[list=1][*] Select [icon]/images/ggb/toolbar/mode_buttonaction.png[/icon] to create question. Name it Question.[/*][*] 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)"[/*][*] In input bar, write "f: y=mx+b"[br][/*][*] In input bar, write "d: y=x". This will be the first players line.[br][/*][*] In input bar, write "t: y=x". This will be the second players line.[br][/*][*] Hide line d and line t.[br][/*][/list]
Step 2
[list=1][*] Click [icon]/images/ggb/toolbar/mode_pointonobject.png[/icon] and then click line f to create random point on f. [br][/*][*] Right click on the point, and select settings.[br][/*][*] Change its name to "Player"[br][/*][*] Againg click [icon]/images/ggb/toolbar/mode_pointonobject.png[/icon] to create another point on the line f.[br][/*][*] Right click this new point and again select settings.[br][/*][*] Change its name to "Hoop"[br][/*][*] In the input bar, write Point(Segment(Player, Hoop)). This will create a point (which will be our ball) between Player and the hoop. [br][/*][/list]
Step 3
[list=1][*] Click [icon]/images/ggb/toolbar/mode_createlist.png[/icon] under the [icon]/images/ggb/toolbar/mode_angle.png[/icon]icon, and create a list by drawing a rectangle between Player and Hoop.[br][/*][*] Your list should consist of only point Player and point Hoop.[br][/*][*] Create another point in f and name it as Hoop'[br][/*][*] In input bar write "sHoopPlayer={"SetValue(Hoop', Hoop)", "SetValue(Hoop, Player)", "SetValue(Player,Hoop')"}"[br][/*][*] Select your list I1 and go to Settings→Scipting→On Update and write "If(y(Hoop)<=y(Player), Execute(sHoopPlayer))"[/*][*]Hide the point Hoop'[/*][/list][br]  In this part, we are now sure that the point Player would never go up the point Hoop.
Step 4
[br][br]1.   Create a new text by clicking [icon]/images/ggb/toolbar/mode_text.png[/icon]button and write "First Player".[br]2.   Drag it to the bottom left of the screen.[br]3.   Click [icon]/images/ggb/toolbar/mode_textfieldaction.png[/icon]to create an input box and name it "Equation" and linked it line d.[br]4.   Drag it under the text1.[br]5.  Again, create a new text and write "Second Player".[br]6.   Drag this one to the bottom right corner. [br]7.   Create a second input box and name it Equation too, but linked it line t.[br]8.   Drag it under the text2.[br]9.   In input bar, write player1=0 click enter. This will create a slider.[br]10. Go to slider settings→slider, change its min to 0 and max to 30[br]11. In ınput bar, write player2=0 and change its[br]settings as player1.[br]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".[br]13. Drag it to the left.[br]14. Repeat step 12 but instead of selecting player1, select player2.[br]15. Drag it to the right.[br]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.[br][br][br]
Step 5
[br][br]1.   Create a text and write "Basket".[br]2.   Drag it to the left.[br]3.   Create another text and again write "Basket".[br]4.   Drag it to the right.[br]5.   Check the names of this newly created texts, note them.[br]6.   Create a button and name it "Fire".[br]7.   In scripting part write:[br]   [br][quote]If(f==d,SetValue(text5,"Basket!"),SetValue(text5,"Missed :("))[br]If(f==t,SetValue(text6,"Basket!"),SetValue(text,6"Missed :(")) [br]If(f==d,SetBackgroundColour(text5,green),SetBackgroundColour(text5, red))     [br]If(f==t,SetBackgroundColour(text6,green),SetBackgroundColour(text6, red)) [br]If(f==d,SetValue(player1,player1+1))[br]If(f==t,SetValue(player2,player2+1))[/quote][br] !!Be careful about paranthesis. If your texts has[br]different name than make sure that the first one goes under the first player[br]and second one goes to second player.[br][br][br]
Step 6
[list=1][*]Insert your ball image by using [icon]/images/ggb/toolbar/mode_image.png[/icon] button. Make sure that your image is in png format and its background is colorless.[/*][*]Resize the image as your wish, than look at the length of the bottom side.[/*][*]Select [icon]/images/ggb/toolbar/mode_segmentfixed.png[/icon] and select bottom left corner of the image and write the size you want your ball would be.[/*][*]Right click the image and go to settings→position. Corner 1 will stay as what it is. [/*][*]Click corner 2 and select the point you have just created. Now you are sure that your image won't change its size.[/*][*]Go to input bar and write "C1=Corner(image1,1)" ; "C2=Corner(image1,2)" ; "C3=Corner(image1,3)" and lastly "C4=Corner(image1,4)"[/*][*]Click [icon]/images/ggb/toolbar/mode_midpoint.png[/icon] to find midpoint of the image. Then select C1 and C3 or C2 and C4. Name this point CB[/*][*]Click [icon]/images/ggb/toolbar/mode_vector.png[/icon] to create a vector. Create 2 vectors the that connect the center of the ball to two adiacent corners.[/*][*]Go to input bar and write CopyFreeObject(image1).[/*][*]In input bar write "E=A-u" ; "F=A-v" and "G=A+u"[/*][*]Go to your new image's settings and change position settings to "Corner 1→F" "Corner2→E" and "Corner4→G"[/*][*]Hide all points you've created and the first image.[/*][*]Right click the Question button and go to settings→scripting→on click and write "SetCoords(A,x(Player),y(Player))[/*][*]Right click the Fire button and go to setting→scripting→on click and write   "If(f==d,StartAnimation(A))[br]   If(f==t,StartAnimation(A))"[/*][*]Now, right click the point A and go to settings→algebra and make speed 2 and in repeat section select "increasing(once)"[/*][/list][br]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.[br][br][br][br]
Step 7
[list=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 )[/*][*]Again, arrange your images at desired size and use segment with given legth tool to make sure they are stable.[/*][*]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.[/*][*]Clicked Question button and go to settings→scripting→on click and write:[quote]SetCoords(F,x(Player-20),y(Player-40))[br]SetCoords(G,x(Player-14),y(Player-3.5))[br]SetCoords(I,x(Hoop-5),y(Hoop-50))[/quote][/*][*]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.[/*][*]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. [/*][*]Place the new text under or top of the question button.[/*][*]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.[/*][*]Select the other player and again go to settings→advanced and in the Condition to Show Object section write "f!=d"[/*][*]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. [/*][/list]
My Background Image
My hoop
Player 1
Player 2

Basketbol

How To Play?
First player starts the game by using coordinates of the player and the hoop in order to find the line equation between player and the hoop. The equation must be in the format of y=mx+b. Then they hit the "Atış" button to fire the ball. If the equation is correct, the ball moves towards the hoop, and a green text that says "Basket" appears. Also the player wins a point for the basket. And the winning player continues the game by hitting the "Soru" button which creates a new line. If the player can not write the correct equation, then it will be other player's turn. The one who collects 30 points wins the game.
Basketball Game

Information