How to Write Script to Make a Ball Move




Introduction: How to Write Script to Make a Ball Move

I am using The program from Khan Academy 
here is a link to it

Step 1: Step 1

To make the background color  simply type          background(0,0,0)
to change the color click on one of the zeros and  you can click on what color you want

Step 2: Step 2

To create the ball you need to type        ellipse(0,0,0,0)
the first  two zeros control where its placed on the page  aka the x and y axis
the second two zeros control how big the ball is
to control what color the ball is  put your cursor infrount of ellipse and hit enter  then go to the space above your ellipse and write fill(0,0,0)
it is the same way to change the color as the background

it should look like this

Tip: make sure you always have a semicolon ( ; )  after every command you type

Step 3: Step 3

you need to make a variable for the first  zero of your ellipse
type  var x = 17

Step 4: Step 4

How to make the movement of the ball
type                   var draw=       
2 brackets will come up copy and paste everything  in them except  the var  x = 17
 then at the bottom of the brackets (still inside the brackets) put
x = x+1
now your done you can see my creation on this link

if you liked this post please follow me to see more



    • Science of Cooking

      Science of Cooking
    • Trash to Treasure

      Trash to Treasure
    • Paper Contest 2018

      Paper Contest 2018

    We have a be nice policy.
    Please be positive and constructive.




    could you make it to a .jar file?
    then you could open it using java.