Hey guys, I need some help. For a school project I am creating a game which involves carrying and dropping objects. Due to circumstances I have to delete the object once it's picked up and place it back when dropped. Now I have the following problem, I use a variable that keeps track of if I'm holding an object and if so, which object by assigning an int value to each object. Here is a small bit of the code:
So if I pick up a "papierenzak" ( Dutch ) it removes the object that I want to, after that it should assign "objectCarrying" with the value 1. However, the value of "objectCarrying" remains 0, but the object gets deleted so that shows it does go trough the loop.
Why isn't the value of "objectCarrying" changing?
int objectCarrying = 0; public void carryObject(){ Actor objectpapier = getOneObjectAtOffset(0, 0, Papierenzak.class); if(objectpapier != null){ if(objectCarrying == 0){ getWorld().removeObject(objectpapier); objectCarrying = 1; } objectCarrying = 1; } if(objectCarrying == 1){ getWorld().addObject(new Papierenzak(), 0, 0); objectCarrying=0; } }