-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.java
More file actions
68 lines (64 loc) · 1.51 KB
/
Index.java
File metadata and controls
68 lines (64 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* This Class manages all the unique identifiers of my objects,
* it makes sure they are all unique and in order
* @author elan
*
*/
public class Index
{
/**
* Updates the Bullets identifiers
*/
public static void updateBulletIndex()
{
for(int i = Controller.bullets.size() - 1; i >= 0; i--)
if(Controller.bullets.get(i).getIndex() != i)
Controller.bullets.get(i).updateIndex(i);
else
break;
}
/**
* Updates the Enemies identifiers
*/
public static void updateEnemyIndex()
{
for(int i = Controller.enemies.size() - 1; i >= 0; i--)
if(Controller.enemies.get(i).getIndex() != i)
Controller.enemies.get(i).updateIndex(i);
else
break;
}
/**
* Updates the EnemyBullets identifiers
*/
public static void updateEnemyBulletIndex()
{
for(int i = Controller.enemyBullets.size() - 1; i >= 0; i--)
if(Controller.enemyBullets.get(i).getIndex() != i)
Controller.enemyBullets.get(i).updateIndex(i);
else
break;
}
/**
* Updates the PowerUpBoxes identifiers
*/
public static void updatePowerUpBoxesIndex()
{
for(int i = Controller.powerUpBoxes.size() - 1; i >= 0; i--)
if(Controller.powerUpBoxes.get(i).getIndex() != i)
Controller.powerUpBoxes.get(i).updateIndex(i);
else
break;
}
/**
* Updates the Bunkers identifiers
*/
public static void updateBunkerIndex()
{
for(int i = Controller.bunkers.size() - 1; i >= 0; i--)
if(Controller.bunkers.get(i).getIndex() != i)
Controller.bunkers.get(i).updateIndex(i);
else
break;
}
}