I'm currently trying to make a function that grabs an object at a random coordinate. The function is within a World subclass, so I cannot use getOneObjectAtOffset() (It's protected). The problem is that after I grab it from the list, it's stuck as an "Object" instead of type "block" (my Actor subclass), so trying to grab or assign values to variables doesn't work properly. Can I somehow convert my Object to an actor subclass? Or is there some other method? I'm stuck!
I appreciate any help, thanks.
public void spawnMines() { for(int mines=10;mines>0;mines--) { int x = Greenfoot.getRandomNumber(9); int y = Greenfoot.getRandomNumber(9); List lBlock; lBlock = getObjectsAt(x, y, null); Object block = lBlock.get(0); if(block.blockStatus!=6) { block.blockStatus=6; block.updateBlock(); } else { mines++; } } }