I'm playing around with some code, trying to learn (I'm new to Java), and I'm wondering if there is any way to code in a dead zone for actors that prevents them from entering?


1 2 3 4 5 | if (!getObjectsInRange( /** some range */ , Spot. class ).isEmpty()) { move( - /** some number */ ); /** turn command */ } |
1 2 3 4 5 | if ((!getObjectsInRange( 1 , InvisibleBarrier. class )).isEmpty()) { turn( 180 ); move( 1 ); } |
1 2 3 4 5 | if (!(((getObjectsInRange( 1 , InvisibleBarrier. class )).isEmpty()))) { turn( 180 ); move( 1 ); } |