added border around next and hold tetromino
This commit is contained in:
parent
c9d00f4f77
commit
075db7a91b
@ -5,7 +5,6 @@ import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.game.Tetri
|
|||||||
import eu.mhsl.minenet.minigames.instance.Dimension;
|
import eu.mhsl.minenet.minigames.instance.Dimension;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.game.Tetromino;
|
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.game.Tetromino;
|
||||||
import eu.mhsl.minenet.minigames.score.PointsWinScore;
|
import eu.mhsl.minenet.minigames.score.PointsWinScore;
|
||||||
import eu.mhsl.minenet.minigames.world.generator.terrain.CircularPlateTerrainGenerator;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.minestom.server.coordinate.Pos;
|
import net.minestom.server.coordinate.Pos;
|
||||||
import net.minestom.server.coordinate.Vec;
|
import net.minestom.server.coordinate.Vec;
|
||||||
@ -25,7 +24,7 @@ class Tetris extends StatelessGame {
|
|||||||
|
|
||||||
public Tetris() {
|
public Tetris() {
|
||||||
super(Dimension.THE_END.key, "Tetris", new PointsWinScore());
|
super(Dimension.THE_END.key, "Tetris", new PointsWinScore());
|
||||||
this.setGenerator(new CircularPlateTerrainGenerator(30).setPlateHeight(0));
|
// this.setGenerator(new CircularPlateTerrainGenerator(20));
|
||||||
|
|
||||||
eventNode()
|
eventNode()
|
||||||
.addListener(PlayerUseItemEvent.class, this::onPlayerInteract)
|
.addListener(PlayerUseItemEvent.class, this::onPlayerInteract)
|
||||||
@ -119,7 +118,7 @@ class Tetris extends StatelessGame {
|
|||||||
p.setSprinting(false);
|
p.setSprinting(false);
|
||||||
|
|
||||||
if(this.tetrisGames.get(p) == null) {
|
if(this.tetrisGames.get(p) == null) {
|
||||||
this.tetrisGames.put(p, new TetrisGame(this, getSpawn().sub(6, 8, 15).add(this.tetrisGames.size()*23, 0, 0)));
|
this.tetrisGames.put(p, new TetrisGame(this, getSpawn().sub(6, 8, 15).add(this.tetrisGames.size()*27, 0, 0)));
|
||||||
this.tetrisGames.get(p).generate();
|
this.tetrisGames.get(p).generate();
|
||||||
}
|
}
|
||||||
TetrisGame tetrisGame = this.tetrisGames.get(p);
|
TetrisGame tetrisGame = this.tetrisGames.get(p);
|
||||||
@ -132,6 +131,6 @@ class Tetris extends StatelessGame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pos getSpawn() {
|
public Pos getSpawn() {
|
||||||
return new Pos(-50, 50, 15).withView(180, 0);
|
return new Pos(0, 30, 15).withView(180, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,11 @@ public class Playfield {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Pos getHoldPosition() {
|
public Pos getHoldPosition() {
|
||||||
return this.lowerLeftCorner.add(-4, 19, 0);
|
return this.lowerLeftCorner.add(-4, 18, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pos getNextPosition() {
|
public Pos getNextPosition() {
|
||||||
return this.lowerLeftCorner.add(14, 19, 0);
|
return this.lowerLeftCorner.add(14, 18, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate() {
|
public void generate() {
|
||||||
@ -50,6 +50,19 @@ public class Playfield {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int x = 0; x < 6; x++) {
|
||||||
|
for(int y = 0; y < 6; y++) {
|
||||||
|
if(x==0 || x==5 || y==0 || y==5) {
|
||||||
|
batch.setBlock(this.getHoldPosition().add(x-2, y-2, 0), Block.BLACK_CONCRETE);
|
||||||
|
batch.setBlock(this.getNextPosition().add(x-2, y-2, 0), Block.BLACK_CONCRETE);
|
||||||
|
batch.setBlock(this.getHoldPosition().add(x-2, y-2, -1), Block.BLACK_CONCRETE);
|
||||||
|
batch.setBlock(this.getNextPosition().add(x-2, y-2, -1), Block.BLACK_CONCRETE);
|
||||||
|
}
|
||||||
|
batch.setBlock(this.getHoldPosition().add(x-2, y-2, -1), Block.QUARTZ_BLOCK);
|
||||||
|
batch.setBlock(this.getNextPosition().add(x-2, y-2, -1), Block.QUARTZ_BLOCK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
batch.setBlock(getPlayerSpawnPosition().sub(0, 1, 0), Block.STONE);
|
batch.setBlock(getPlayerSpawnPosition().sub(0, 1, 0), Block.STONE);
|
||||||
|
|
||||||
// batch.setBlock(getPlayerSpawnPosition(), Block.IRON_TRAPDOOR.withProperty("half", "bottom"));
|
// batch.setBlock(getPlayerSpawnPosition(), Block.IRON_TRAPDOOR.withProperty("half", "bottom"));
|
||||||
|
@ -97,7 +97,7 @@ public class TetrisGame {
|
|||||||
this.playfield.generate();
|
this.playfield.generate();
|
||||||
|
|
||||||
this.currentTetromino.setPosition(this.tetrominoSpawnPosition);
|
this.currentTetromino.setPosition(this.tetrominoSpawnPosition);
|
||||||
this.currentTetromino.draw();
|
this.currentTetromino.draw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user