Skip to content

Instantly share code, notes, and snippets.

@pxpc2
Created July 31, 2012 18:59
Show Gist options
  • Save pxpc2/3219497 to your computer and use it in GitHub Desktop.
Save pxpc2/3219497 to your computer and use it in GitHub Desktop.
/**
* @param trap the trap SceneObject
*/
public static void activateTrap(SceneObject trap)
{
if ((trap != null) && (trap.isOnScreen()))
{
Tile loc = trap.getLocation();
trap.interact("Set-trap");
Time.sleep(2000);
System.out.println("trap id: " + trap.getId());
SFields.inactivity = new Timer(0);
while (SceneEntities.getAt(loc.getX(), loc.getY()).getId() != SConstants.SWAMP_LIZARD_TRAP_WAITING)
{
Time.sleep(700);
if (SFields.inactivity.getElapsed() > 7000)
return;
}
System.out.println(SceneEntities.getAt(loc.getX(), loc.getY()).getId());
if (SceneEntities.getAt(loc.getX(), loc.getY()).getId() == SConstants.SWAMP_LIZARD_TRAP_WAITING)
{
System.out.println("io");
SFields.trapTiles.add(loc);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment