Occlusion attempt 1
This commit is contained in:
+35
-7
@@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use crate::tile::{Tile, TileState};
|
||||
use crate::constants::*;
|
||||
use crate::tile::{Tile, TileState};
|
||||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Bundle)]
|
||||
pub struct TilePrefab {
|
||||
@@ -18,7 +18,10 @@ impl TilePrefab {
|
||||
image: asset_server.load("dirt.png"),
|
||||
..Default::default()
|
||||
},
|
||||
tile: Tile {id:1},
|
||||
tile: Tile {
|
||||
id: 1,
|
||||
opaque: true,
|
||||
},
|
||||
tile_state: TileState {
|
||||
timer: Timer::from_seconds(1.0, TimerMode::Repeating),
|
||||
},
|
||||
@@ -32,7 +35,10 @@ impl TilePrefab {
|
||||
image: asset_server.load("grass.png"),
|
||||
..Default::default()
|
||||
},
|
||||
tile: Tile {id:2},
|
||||
tile: Tile {
|
||||
id: 2,
|
||||
opaque: true,
|
||||
},
|
||||
tile_state: TileState {
|
||||
timer: Timer::from_seconds(1.0, TimerMode::Repeating),
|
||||
},
|
||||
@@ -46,7 +52,10 @@ impl TilePrefab {
|
||||
image: asset_server.load("rock.png"),
|
||||
..Default::default()
|
||||
},
|
||||
tile: Tile {id:3},
|
||||
tile: Tile {
|
||||
id: 3,
|
||||
opaque: true,
|
||||
},
|
||||
tile_state: TileState {
|
||||
timer: Timer::from_seconds(1.0, TimerMode::Repeating),
|
||||
},
|
||||
@@ -59,10 +68,29 @@ impl TilePrefab {
|
||||
image: asset_server.load("sky.png"),
|
||||
..Default::default()
|
||||
},
|
||||
tile: Tile {id:0},
|
||||
tile: Tile {
|
||||
id: 0,
|
||||
opaque: false,
|
||||
},
|
||||
tile_state: TileState {
|
||||
timer: Timer::from_seconds(1.0, TimerMode::Repeating),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn bedrock(position: Vec3, asset_server: &Res<AssetServer>) -> Self {
|
||||
TilePrefab {
|
||||
transform: Transform::from_translation(position).with_scale(Vec3::splat(PIXEL_RATIO)),
|
||||
sprite: Sprite {
|
||||
image: asset_server.load("bedrock.png"),
|
||||
..Default::default()
|
||||
},
|
||||
tile: Tile {
|
||||
id: 4,
|
||||
opaque: true,
|
||||
},
|
||||
tile_state: TileState {
|
||||
timer: Timer::from_seconds(1.0, TimerMode::Repeating),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user