Who Can teach me forest the last level gems or death code?

Who Can teach me forest the last level gems or death code?
forest levels the last level was gems or death ,Who Can teach me how writing the code?

Mainly you just have to fix the if statements so they are true:

for example (python):

if 2 + 2 > 4:

needs to be changed so that the statement is true

if 2 + 2 == 4:
    ...
# or
if 2 + 2 > 3:
    ...
# or
if 2 + 3 > 4:
   ...

Well, you only want to fix the ifs that you want to run and break any that you don’t want running…

Ugh, on mine even though I did the if 2<1 thing is always says its true, no matter what! Which is really weird, can anyone help? And I do javascript.

Can you paste that whole if so we can look at it.

1 Like

Sure,

if (2 < 1) {
this.moveXY(40, 55);
}
if (true) {
this.moveXY(50, 10);
}
if (false) {
this.moveXY(55, 25);
}

it always goes to true…so yeah

When you say:

and also:

Do you mean your hero does:

if (2 < 1) {
this.moveXY(40, 55);
}

and gets attacked by ogres or that your hero does:

if (true) {
this.moveXY(50, 10);
}

and gets blown up?

Because, if you are referring to the second one: moveXY(50,10). Well, “if (true)” is always true . . . so you need to change it to something that is not true…

Ohh, so do you change the false one?

Merged Doublepost

Never mind, I got it! Thanks!! :smile:

I need help with the coding can any one help me ?

We need more information than that! Give us a description of your problem. Your code, properly formatted of course. A screenshot, perhaps.

1 Like

i dont no whats wrong with my code

If-statement code only runs when the if’s condition is true.

Fix all the if-statements to beat the level.

== means “is equal to”.

if 1 + 1 + 2 == 3: # ∆ Make this false.
self.moveXY(5, 15) # Move to the first mines.

if 2 + 3 == 5: # ∆ Make this true.
self.moveXY(15, 40) # Move to the first gem.

!= means “is not equal to”.

if 2 + 2 = 4: # ∆ Make this true.
self.moveXY(25, 15) # Move to the second gem.

< means “is less than”.

if 2 + 0 < 3: # ∆ Make this true.
enemy = self.findNearestEnemy()
self.attack(enemy)

if 9 < 4: # ∆ Make this false.
self.moveXY(40, 55)

if 5 + 2 == 30: # ∆ Make this false.
self.moveXY(50, 10)

if 2 + 2 = 4: # ∆ Make this true.
self.moveXY(55, 25)

Please read the FAQ to learn how to properly post code. It makes it easier to find out what is wrong. I spotted one problem in
if 2 + 2 = 4:
It should be:
if 2 + 2 == 4:
or
if 2 + 2 is 4:

use = to set a variable and == or is to check what something is.