java - How do I compare elements in a vector(class)? -
i'm making game , when update coordinates of "entities", if exceed screen limit, appear in part, , score increased, how more 1 entity, score increased more once, i've tried using in each cycle:
for(entity e: entities){ //updating stuff if(e.exceed_the_limit)//or whatever { if(e.equals(entities.get(entities.size)))score++; } }
so should compare if element first of vector increase score, exception:
java.lang.arrayindexoutofboundsexception: length=1; index=1t
i've tried elementat() same error. should check if it's first time increases?
Comments
Post a Comment