mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 19:55:02 +01:00
Use the world "tile" instead of "block"
This commit is contained in:
parent
fbc7e35f9e
commit
7a3018c2b1
2 changed files with 10 additions and 10 deletions
|
|
@ -17,7 +17,7 @@ It is a liquid layer, an endless sea of extremely hot and destructive lava.
|
|||
It's the end of progression, bottom of the map, can't progress further.
|
||||
The evil source is somewhat above that, at about 100 km.
|
||||
The final goal is the evil source, so player is expected to mine about 100 km deep to beat the game.
|
||||
1 meter = one block. 100 km = 100,000 blocks deep.
|
||||
1 meter = one tile. 100 km = 100,000 tiles deep.
|
||||
|
||||
## Number of stuff
|
||||
|
||||
|
|
|
|||
18
src/world.rs
18
src/world.rs
|
|
@ -22,28 +22,28 @@ impl Default for World {
|
|||
}
|
||||
|
||||
const CHUNK_EXTENT: u16 = 256;
|
||||
const CHUNK_N_BLOCKS: usize = CHUNK_EXTENT as usize * CHUNK_EXTENT as usize;
|
||||
const CHUNK_N_TILES: usize = CHUNK_EXTENT as usize * CHUNK_EXTENT as usize;
|
||||
|
||||
type ChunkBlocks = [Block; CHUNK_N_BLOCKS];
|
||||
type ChunkTiles = [Tile; CHUNK_N_TILES];
|
||||
|
||||
pub struct Chunk {
|
||||
blocks: ChunkBlocks,
|
||||
tiles: ChunkTiles,
|
||||
}
|
||||
|
||||
impl Chunk {
|
||||
pub fn new_rand() -> Self {
|
||||
let mut rng = thread_rng();
|
||||
let mut blocks = [Block { id: 0 }; CHUNK_N_BLOCKS];
|
||||
for b in &mut blocks {
|
||||
let mut tiles = [Tile { id: 0 }; CHUNK_N_TILES];
|
||||
for b in &mut tiles {
|
||||
b.id = rng.gen();
|
||||
}
|
||||
Self { blocks }
|
||||
Self { tiles }
|
||||
}
|
||||
}
|
||||
|
||||
type BlockId = u16;
|
||||
type TileId = u16;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Block {
|
||||
id: BlockId,
|
||||
pub struct Tile {
|
||||
id: TileId,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue