|
7 | 7 | import minicraft.gfx.Point;
|
8 | 8 | import minicraft.gfx.SpriteLinker;
|
9 | 9 | import minicraft.level.Level;
|
| 10 | +import minicraft.level.tile.FlowerTile; |
10 | 11 | import minicraft.level.tile.DirtTile;
|
11 | 12 | import minicraft.level.tile.GrassTile;
|
12 | 13 | import minicraft.level.tile.Tile;
|
@@ -56,15 +57,13 @@ public boolean interactOn(Tile tile, Level level, int xt, int yt, Player player,
|
56 | 57 | renderingTick++;
|
57 | 58 | Random random = new Random();
|
58 | 59 | if (renderingTick >= 8) {
|
59 |
| - int px = player.x + 16 * attackDir.getX(); |
60 |
| - int py = player.y + 16 * attackDir.getY(); |
61 |
| - |
62 | 60 | for (int i = 0; i < 4; i++) {
|
63 | 61 | SpriteLinker.LinkedSprite splash = spriteSplash[random.nextInt(spriteSplash.length)];
|
64 |
| - int x = px + random.nextInt(5) - 2; |
65 |
| - int y = py + random.nextInt(5) - 2; |
66 |
| - int destX = px + random.nextInt(3) - 1; |
67 |
| - int destY = py + random.nextInt(3) - 1; |
| 62 | + // 2-pixel deviation for centering particle sprites. |
| 63 | + int destX = player.x - 2 + 12 * attackDir.getX() + random.nextInt(9) - 4; |
| 64 | + int destY = player.y - 2 + 12 * attackDir.getY() + random.nextInt(9) - 4; |
| 65 | + int x = player.x - 2 + 4 * attackDir.getX() + random.nextInt(5) - 2; |
| 66 | + int y = player.y - 2 + 4 * attackDir.getY() + random.nextInt(5) - 2; |
68 | 67 | level.add(new WaterParticle(x, y, 80 + random.nextInt(61) - 30, splash, destX, destY));
|
69 | 68 | }
|
70 | 69 | renderingTick = 0;
|
|
0 commit comments