In my player class i have a public static boolean canMove if its true the player can move. I want to have it so that when the actor intersects a specific actor that this variable is set to false for a specified amount of time and then set it back to true.
i tried doing this wtih this function
it returns the error in the comment on Thread.sleep(3000). correct me if im wrong but using this method if there were no error would result in all of greenfoot becoming unresponsive, which i don't want just want the player to not be able to move for 3 seconds while everything else continues to move
protected void collideWithPlayer() { if(this.isTouching(player.class)){ player.canMove = false; long start = System.currentTimeMillis(); for(int i = 0; i < 5; i++){ Thread.sleep(3000); //unreported exception //java.lang.interuptedexecution; must //be caught or declared to be thrown } player.canMove = true; } }