Created
June 10, 2012 23:42
-
-
Save homelinen/2907737 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Monitors projectiles and whether they should be | |
* destroyed or not | |
* @author homelinen | |
* | |
*/ | |
public class ProjectileGarbageCollector implements PhysicsCollisionListener{ | |
String worldName; | |
public ProjectileGarbageCollector(String worldName) { | |
this.worldName = worldName; | |
} | |
@Override | |
public void collision(PhysicsCollisionEvent event) { | |
Logger.getLogger(ProjectileGarbageCollector.class.getName()).log(Level.INFO, "WorldName is {0}, should be \"terrain\"", worldName); | |
Logger.getLogger(ProjectileGarbageCollector.class.getName()).log(Level.INFO, "NodeA is: {0}", event.getNodeA()); | |
Logger.getLogger(ProjectileGarbageCollector.class.getName()).log(Level.INFO, "NodeB is: {0}", event.getNodeB()); | |
//Check for collision against world | |
if (event.getNodeA().getName().equals(worldName) || event.getNodeB().getName().equals(worldName)) { | |
Logger.getLogger(ProjectileGarbageCollector.class.getName()).log(Level.INFO, "Collision with world"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment