I have more arrays where I made some swords on the tiled map and when I step on them, Should, but when I crash them on the game Java.util.ArrayList $ Ether On checker commodification (java.util.ArrayList $ Itr.next) unknown source (unknown source)
MY code:
I think searching for the loop object is good Is he just removed?
Private list & lt; Sword & gt; Swords = New Arrestists & lt; Sword & gt; ();
I create them once:
Public Gamer (Game World World, Int Gamedhit) {for (int i = 0; i & lt ; 100; i ++) {Swords (Add new sword ()); }
When I step on it:
For (sword sword: swords) {if (play + 7> gt; = sword .position.y & amp; amp; amp; amp;; + 7 + lighter = sword.search.i + tiles & amp; player x + 7> gt; sword = refine. X & amp; player + 7 & Lt; = sword.search.x + tilesize) {sword.pickMe;); Swords.remove (sword); }}
There are other loops in the render ():
for (sword sword: swords) {sword.createMe (); }
I do not need to see the sword class. If you do, then I will keep it here. How do I fix this so I do not get the error?
sword sword: swords) (if (play + 7> gt; sword.find And Players + 7 & lt; = Swords.Edit. + Tiles size and player area + 7> gt; sword.search.keeping. And & amp; amp; amp; player + 7 & lt; = sword.position. X + tilesize) {sword.pickMe (); swords.remove (sword); / /> this row concurrent modification exception}}
How to increase
Loop works, you either Iterator
iterator gt; Rater = sword. While (iterator.hasNext ()) {sword sword = iterator.next (); if (plariyes + 7> gt; sword.search.and & plariyes + 7 & lt; = sword.find. Y + Tiles & amp; Player x + 7> gt; sword = search.print.shank. & Amp; amp; amp; player player + 7 & lt; = sword.section.x + tilesize) {sword.pickMe (); Iterator.remove ();}}
or lower:
for (int i = 0; i gt; sword.search.or & amp; plaryis + 7 & lt; = sword.section.a + tiles & amp; player x + 7> gt; sword = search.print. & Amp; player player + 7 & lt; = sword.x.x + tilesize) {sword.pickMe (); Swords.remove (i--); }}
Comments
Post a Comment