JavaScript tutorial (Part 1)

its easier than having to write window. before the script

Does this work for movement?

this.left(12)

What's this?

thats just

this.forward(-10)

The sprite object if you run it in the JSFunction block

No that just returns the left side of the sprite's bounding box

Okay; since window is the default object, you don't have to type window.

uzjsjaijnasijn, how am I supposed to know which number is where?

pos goes right, neg goes left

Yeah, but what number type goes up and down?

Complex numbers! (it's a joke, but it theoretically would work)

1 Like

oh, so you mean complex numbers like:

1-10? or one to ten?

The binary operations don't "convert" numbers to binary. They have been binary numbers the whole time. Really the computer has to convert them to their decimal representation. So it is not accurate to say that.

I am going to fix that

I think means stuff like 5+2i and i = square root of -1 i don't know how i know that

oh i get it because you can represent imaginary numbers as perpendicular to the regular number line the x-axis being the regular number line and y-axis being the imaginary number line

Either I don't know either, or my memory is bad. Or my brain is fried.

I think that's like 11th grade math

I'm in middle school, 7th grade. I'm the usual dumb person in class because I failed 7th grade once, this is my second year in 7th grade....

I can explain complex numbers.

Creation of negative numbers

Let's start with the non-negative real number line.

|--|--|--|--|--|-->
0  1  2  3  4  5

You can add numbers. Go to the first number, then move right by the second number.
Example: 3 + 2

|--|--|--|--|--|-->
0  1  2  3  4  5
         *--|--|
            1  2

3 + 2 = 5
You can subtract numbers. Go to the first number, then move left by the second number.
Example: 4 - 2

|--|--|--|--|--|-->
0  1  2  3  4  5
      |--|--*
      2  1

4 - 2 = 2
Talking about movement, these numbers can tell you how far to move to the right. What about moving to the left? What is 3 - 4?

   |--|--|--|--|--|-->
   0  1  2  3  4  5
|--|--|--|--*
4  3  2  1

We have gone out of the number line. What do we do? We create negative numbers!

 <--|--|--|--|--|--|--|-->
   -1  0  1  2  3  4  5
    |--|--|--|--*
    4  3  2  1

3 - 4 = -1

Creation of complex numbers

Squaring a number means to multiply the number by itself.
The square root of a number n is the number to square to get n.
0 squared is 00 or 0, so the square root of 0 is 0.
1 squared is 1
1 or 1, so the square root of 1 is 1.
2 squared is 22 or 4, so the square root of 4 is 2.
3 squared is 3
3 or 9, so the square root of 9 is 3.
4 squared is 4*4 or 16, so the square root of 16 is 4.
What is the square root of a negative number?
Multiplying by a positive number stays on the same side of 0 on the number line.
Multiplying by a negative number flips it to the other side of 0 on the number line.
The square of a negative number is a negative multiplied by itself (negative times negative).
We start on the negative side, then the other number flips it to the positive side.
So, positive numbers technically have two square roots: one positive and one negative.
Let's make up an imaginary number: i. We define i as the square root of -1.
So, positive numbers stay on the same side, negative numbers flip to the other side, but what about multiplying i? It rotates the number counterclockwise 90 degrees.
It's no longer a number line: it is now a number plane!

            ^ Im
           ---
           ---
           ---
<--|--|--|--+--|--|--|--> Re
           ---
           ---
           ---
           ---
            V

There are two forms of a complex number: rectangular and polar.
Rectangular: a + bi; a is the real part (the x-position) and b is the imaginary part (the y-position).
Polar: r∠θ; r is the radius, or magnitude, or absolute value, or how far the number is from 0 + 0i and θ is the angle or which direction from 0 + 0i to point towards the complex number

Let's square i: we start at the top; what does multiplying it do? It rotates to the left, which is where -1 is! Yay!

1 Like

I mean did u failed math?Also, you don't have to know square root for 7th grade I think.
If u only failed 1 subject then I think it's unfair to study 7th grade again.

I failed math and science. Almost failed Social Studies. Not to mention, I also failed summer school.