Jump to content
public boolean isEnemyInRange(List<Ennemy> listeMonstres)
    {
        listeMonstres.forEach((Ennemy ennemy) -> 
        {
            if (rayonRange.contains(ennemy.getPosition().x, ennemy.getPosition().y) && attackSpeed.isOver()) {
                this.cible = ennemy;
                peuAttaquer = true;
                attackSpeed.reset();
            }
        }
        );
        return peuAttaquer;
    }

rayonRange is declare as an "int", error happens at if statement, sorry for use of french words in the code

Link to comment
https://linustechtips.com/topic/921988-java-slic2d-int-cannot-be-defferenced/
Share on other sites

Link to post
Share on other sites

19 hours ago, DtrollMC said:

Well AFAIK, int does not have a method contains(...) so if rayonRange is an int, there's no way to see what it contains since it's just a primitive int.

 

It would help if you told me what the if statement SHOULD be. 

thanks, I found the mistake this morning, rayonRange in an attribute I was using for creating a circle and instead of writing circle.contains I wrote that...

Link to post
Share on other sites

2 hours ago, geo3 said:

Not very performant, limited libraries and frameworks geared to game dev, requires end users have the right version of Java installed.

And yet Minecraft happened.

AMD Ryzen 7800 X3D, MSI B650 Project Zero, Antec C5, Gigabyte RTX 4080 Super Aero

 

Nikon D500 | Nikon 300mm f/4 PF  | Nikon 200-500 f/5.6 | Nikon 50mm f/1.8 | Tamron 70-210 f/4 VCII | Sigma 10-20 f/3.5 | Nikon 17-55 f/2.8 | Tamron 90mm F2.8 SP Di VC USD Macro | Neewer 750II

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×