April 10, 201510 yr So say i have a bird snare and i want to refer back to at that specific position.. How would i refer back to it later?? so like i want to be like birdSnareOrigin.interact("pickup"); but how would i declare that...
April 10, 201510 yr // Define this as a field, not local var! ArrayList<Position> mySnares = new ArrayList<Position>(); // Run this when you want to add a Position mySnares.add(theSnareEntity.getPosition()); // Run this when you want to retrieve a snare via its Position Entity mySnare = getObjects().closest(new NameFilter("Snare"), new PositionFilter(mySnares.get(snareIndex)); mySnares.remove(snareIndex); mySnare.interact("Pickup"); Edited April 10, 201510 yr by dudeami
April 10, 201510 yr // Define this as a field, not local var! ArrayList<Position> mySnares = new ArrayList<Position>(); // Run this when you want to add a Position mySnares.add(theSnareEntity.getPosition()); // Run this when you want to retrieve a snare via its Position Entity mySnare = getObjects().closest(new NameFilter("Snare"), new PositionFilter(mySnares.get(snareIndex)); mySnares.remove(snareIndex); mySnare.interact("Pickup"); linked lists are usually better performance when doing a lot of adding/removing from the lists
April 10, 201510 yr linked lists are usually better performance when doing a lot of adding/removing from the lists Not something to worry about at this level :p
April 10, 201510 yr Author Not something to worry about at this level I understand lists and stuff, just not the syntax or stuff like filters and some other stuff... my knowledge is limited to AP CS teachings,. Where just learning really about polymorphism, inheritance, and stuff like that for sub and super classes atm Edited April 10, 201510 yr by iponu777
Create an account or sign in to comment