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

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -