1 package de.lathanda.eos.game.geom;
3 import de.lathanda.eos.game.Game;
4 import de.lathanda.eos.game.Sprite;
5 import java.util.SortedSet;
6 import java.util.TreeSet;
39 private final SortedSet<Sprite> list =
new TreeSet<>();
40 private final Game game;
82 SortedSet<ShapeOrder> xList =
new TreeSet<>();
83 SortedSet<Shape> open =
new TreeSet<>();
92 xList.add(
new ShapeOrder(ShapeOrder.OrderType.X0, shape));
93 xList.add(
new ShapeOrder(ShapeOrder.OrderType.X1, shape));
102 for (ShapeOrder shapeOrder : xList) {
103 switch (shapeOrder.bracket) {
105 open.add(shapeOrder.shape);
108 open.remove(shapeOrder.shape);
111 for (
Shape id : open) {
112 if (
id.getBottom() < shapeOrder.shape.getTop() && shapeOrder.shape.getBottom() <
id.getTop()) {
113 col =
new Collision(shapeOrder.shape,
id);
118 if (col.verifyCollision()) {
119 if (!col.a.getSprite().processCollision(col.b.getSprite(), game)) {
120 col.b.getSprite().processCollision(col.a.getSprite(), game);
CollisionDetection(Game game)
void removeObject(Sprite sprite)
void addObject(Sprite sprite)
void setSprite(Sprite sprite)