12345678910111213141516171819202122232425262728293031323334353637383940 |
- package me.hammerle.supersnuvi.tiles;
- import me.hammerle.supersnuvi.gamelogic.Level;
- import me.hammerle.supersnuvi.util.Utils;
- public class RampTile extends BaseTile
- {
- private final float lx1;
- private final float ly1;
- private final float lx2;
- private final float ly2;
-
- public RampTile(float tMinX, float fMinY, float tMaxX, float tMaxY, float x1, float y1, float x2, float y2)
- {
- super(tMinX, fMinY, tMaxX, tMaxY);
- lx1 = x1;
- ly1 = y1;
- lx2 = x2;
- ly2 = y2;
- }
- @Override
- public boolean shouldAiUseCollisionBox(int x, int y, Level l)
- {
- return false;
- }
- @Override
- public boolean isMoveColliding(float minX, float minY, float maxX, float maxY, int x, int y, Level l)
- {
- float x1 = Utils.toCoord(x) + lx1;
- float y1 = Utils.toCoord(y) + ly1;
- float x2 = Utils.toCoord(x) + lx2;
- float y2 = Utils.toCoord(y) + ly2;
- return Utils.intersect(x1, y1, x2, y2, minX, minY, maxX, minY) ||
- Utils.intersect(x1, y1, x2, y2, maxX, minY, maxX, maxY) ||
- Utils.intersect(x1, y1, x2, y2, maxX, maxY, minX, maxY) ||
- Utils.intersect(x1, y1, x2, y2, minX, maxY, minX, minY);
- }
- }
|