# Help with a short game code

**URL:** https://discourse.processing.org/t/help-with-a-short-game-code/11108
**Category:** Coding Questions
**Created:** [May 10, 2019, 2:54pm UTC](https://discourse.processing.org/t/help-with-a-short-game-code/11108 "2019-05-10T14:54:23Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [May 10, 2019, 3:56pm UTC](https://discourse.processing.org/t/help-with-a-short-game-code/11108/2 "2019-05-10T15:56:32Z")

</div>

We can’t use method **remove()** when using an “enhanced” `for ( : ) {}` style! 🚫

Use a vanilla `for ( ; ; ) {}` style instead. Preferably, w/ backwards iteration: 🔙

> [@\[SOLVED\] Py.processing bullet and enemy collision](https://discourse.processing.org/t/solved-py-processing-bullet-and-enemy-collision/8327/4):
>
> @solub, your solution is buggy! bug When we delete an item from a list, all elements w/ a higher index than the deleted item got their indices subtracted by 1! face_with_monocle They’re left-shifted, and therefore, the next iteration skips an item; which now got the same index as the just deleted item. arrow_left You can see that bug in this sample loop below: eye : nums = list(range(10)) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for n in nums: print n nums.remove(n) print nums # [1, …

---

_[View the full topic](https://discourse.processing.org/t/help-with-a-short-game-code/11108)._
