How to put a ">" sign after "==" in an if statement

Hi, im kind of new to processing and I am working on a starter fighting game and one of the things that I am using to make it so my character can hit the enemy is if statements. I want to type it out like <
<
if(knightX-monsterX == >5) {
reach = “true”;
}

But this isn’t possible so I was wondering if there are any work arounds or any way to do this.

Thanks

Hello @mx.pq,

There are resources here to get you started:

Reference:
https://processing.org/reference#control

:)

The way id do it is

if(knightX-monsterX >= 5){ // or <= 
   reach = true; //if reach is a boolean "true" if reach is a string
}
1 Like

There’s no operator ==> in Java. It’s just >= instead:

Also I believe you didn’t mean a String “true” literal but keyword true instead: reach = true;

You’re gonna need to learn collision detection for it: