Hey guys, I made a little project where there is a room with 5 compartments. There are 5 squares with different weights. When two squares hit eachother, the heaviest square should move to the right compartment and the leightest one to the left one. But how can I make them compare their weight? This is the setup:
Actor
Square
Square_1
Square_2 etc.
This is part of the code, I made a pubic static int variable at every square.
int x = getX();
if (collision(Square.class))
{
int m = Square.massa;
if (massa < m)
{
up(Square.class);
if (x > 224)
{
setLocation(x - 224, 32);
}
}