I have trucks and containers, and the containers can only get loaded onto the trucks if they are the same color.
I assume i need to call the color values of the "containerPicked" and not the container class itself because it might not check the right container.
Does anyone know how the "containerPicked" can take values from the container class?
Anyone ideas?
public void containerContact () { Harbor world = (Harbor)getWorld(); Container container = world.getContainer(); containerPicked = getOneObjectAtOffset(0, (getImage().getHeight()/2) - containerHeight, Container.class); if (! isStillHeld && containerPicked != null) // isStillHeld checks if another object is controlling the container right now { if (this.isBlue == true && container.getBlue() == true) { setContainerLoaded(containerPicked); isLoaded = true; } else if (this.isRed == true && container.getRed() == true) { setContainerLoaded(containerPicked); isLoaded = true; } else if (this.isGrey == true && container.getGrey() == true) { setContainerLoaded(containerPicked); isLoaded = true; } else if (this.isYellow == true && container.getYellow() == true) { setContainerLoaded(containerPicked); isLoaded = true; } } }