aboutsummaryrefslogtreecommitdiffstats
path: root/src/ru/olamedia/olacraft/weapon/BulletScene.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ru/olamedia/olacraft/weapon/BulletScene.java')
-rw-r--r--src/ru/olamedia/olacraft/weapon/BulletScene.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/ru/olamedia/olacraft/weapon/BulletScene.java b/src/ru/olamedia/olacraft/weapon/BulletScene.java
new file mode 100644
index 0000000..1e5ea05
--- /dev/null
+++ b/src/ru/olamedia/olacraft/weapon/BulletScene.java
@@ -0,0 +1,35 @@
+package ru.olamedia.olacraft.weapon;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.media.opengl.GLAutoDrawable;
+
+public class BulletScene {
+ private List<Bullet> bullets = new ArrayList<Bullet>();
+
+ public void add(Bullet b) {
+ bullets.add(b);
+ }
+
+ public int getCount(){
+ return bullets.size();
+ }
+
+ public void update(float deltas) {
+ for (int i = 0; i < bullets.size(); i++) {
+ Bullet b = bullets.get(i);
+ b.update(deltas);
+ if (b.toRemove) {
+ bullets.remove(b);
+ i--;
+ }
+ }
+ }
+
+ public void render(GLAutoDrawable drawable) {
+ for (Bullet b : bullets) {
+ b.render(drawable);
+ }
+ }
+}