Help: Levels in Glacier

To find the vector attack you follow the usual step of making a vector:
Vector.subtract from the enemy.pos to you.
Read the guide very carefully…
Then you make a variable which stores the angle of the attack in Radians. (Radians are another way of expressing angles. They go from 0 to PI (3.14).)
You use Math.atan2(x, y). Of course x and y will be represented by the .x and .y properties of the vector you make from the enemy.pos to you.

1 Like

Please explain this?

Just take it one line at a time. You know how to make a vector from them to you don’t you? You use Vector.subtract(). You did it in skating away.
Do that, then you can write another line which stores a value created by the function Math.atan2(x, y). It will be like radians = Math.atan2(x, y). X and Y will be the .x and the .y functions of the vector you make.
Start with making the vector and post your code.

1 Like

In trigonometry, atan() is the inverse function of tan().
Here’s what the typical right-triangle looks like:


The general rule of thumb are:

  • Solving for the sine of an angle = Opposite/Hypotenuse
  • Solving for the cosine of an angle = Adjacent/Hypotenuse
  • Solving for the tangent of an angle = Opposite/Adjacent

Hence the simple mnemonic device, Soh Cah Toa.

So what does Math.tan, Math.sin, and Math.cos do?

To say things simple, the computer takes in the angle(Theta θ), and returns the corresponding sine, cosine, or tangent of that angle. Why is this useful? Take the following example:


Let’s say we want to find x. How do we do that? We’d use trigonometry to find the value of x given the angle theta(35˚) and the opposite length(8).
Since we’re solving for the hypotenuse and have the opposite length, we’d use Math.sin().
In order to solve it, we’d set up an equation:
sin(35) = 8/x
Multiply both sides by x to get:
x * sin(35) = 8
Then divide both sides by sin(35) and we get:
x = 8 / sin(35)
Hence the length of x(Hypotenuse) is:
About 13.947574364

However, in Bombing Run. we need to find the angle(Theta) given the x Direction(Adjacent) and the y Direction(Opposite). But the following methods will not work for that. So how do we solve it?

We use the inverse of Math.tan(). An inverse function undoes what the function does. This means if f(x) is the function and g(x) is the inverse, then both f(g(x)) and g(f(x)) returns x. So if Math.tan() gives us the decimal of Opposite/Adjacent given the angle, then the inverse will give us the angle given the Opposite/Adjacent! This is what Math.atan() does!

Let’s try to find the angle Theta θ from the following triangle.

Since we have the Adjacent and the Opposite lengths, we’d use atan() or the inverse of a tangent. So we’d simply do:
atan(3/4)
Which gives us 0.643501109 radians.
Then we’d multiply that by 180/PI to get 36.8698976493 ˚!

The same can be used in the actual level. First, you’d want to get the Vector from your hero’s position to your enemy’s position. This can be done with variable = enemy.pos.subtract(hero.pos). Then, we’d want to find the Opposite and Adjacent lengths. To find the Adjacent, you’d find the X DIRECTION of the Vector, which can be found by variable.x. (The name variable comes from the previous Vector direction). This means that the Y DIRECTION or the Opposite can be found by variable.y.


O = Opposite, A = Adjacent
Then you can get the inverse tangent or atan by calling Math.atan(Y DIRECTION / X DIRECTION or Math.atan2(Y DIRECTION, X DIRECTION). It’s also important to note that the value it returns is in radians. However, we need degrees, hence we’d have to multiply the above value by 180 / PI to get the value in degrees.

That should be all you really have to do for this level. Good luck! Trigonometry is extremely simple and easy once you know the basics :slight_smile:

8 Likes

Uhhh… I’m in 3rd grade. Um, I don’t know what to say, except that I’m going to study that thing for an hour. uh… yeah. Um, simplify that please?

5 Likes

Yeah you don’t learn this until 7th or 6th grade so he might need a better explanation.

1 Like

For math, I’m ahead of my grade but still, my average is 3rd. Maybe two grades ahead of my grade, my class is still learning multiplication of whole numbers, last time I checked. Like, seriously? I can divide fractions. multiply decimals. divide decimals. add and subtract fractions. Or let’s just say I’m good at arithmetic, and very bad at geometry. Yeah, I’ll just say that.

2 Likes

Dude, since you’re here, um, can you try to be more helpful than just liking posts? Thx.

I like your post and I don’t know exactly how to help you

That’s literally the simplest I can get without ruining learning experience.

7 Likes

Question: am I allowed to skip that level

If you use links yeah, but I wouldn’t skip it.

Chaboi told you what you need to do. At the beginning is the basics. At the end is how to solve the level.

1 Like

It depends if the level has the same concepts it should be fine but for really hard level(ex: Gridmacder Redux and Kelvintaph Defiler)

1 Like

These levels come in sets, so skipping them isn’t a good idea. If you can learn the concept in the sets, the other levels become easier to complete.

1 Like

I like how you did that!

You quote a post by highlighting it and then a thing will pop up saying quote and you click on that and it is on a reply and boom you are done.

1 Like

Ugh, how much longer do you think it’ll take for me to complete bombing run? Like I really just can’t help to complain about how long I’m spending on bombing run. Plz estimate how much longer it’ll take.

1 Like

You can finish it now if you follow Chaboi’s instructions.

1 Like

yeah, but I don’t understand them.

1 Like