better magic map anim
This commit is contained in:
parent
8462eab0bd
commit
e8eaa69909
2 changed files with 14 additions and 9 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,4 +1,6 @@
|
||||||
/target
|
/target
|
||||||
.rustfmt.toml
|
.rustfmt.toml
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
.gifs/*
|
||||||
|
.savegames/*
|
||||||
savegame.json
|
savegame.json
|
||||||
21
src/main.rs
21
src/main.rs
|
|
@ -319,15 +319,19 @@ impl GameState for State {
|
||||||
RunState::MagicMapReveal { row, cursed } => {
|
RunState::MagicMapReveal { row, cursed } => {
|
||||||
let mut map = self.ecs.fetch_mut::<Map>();
|
let mut map = self.ecs.fetch_mut::<Map>();
|
||||||
|
|
||||||
|
// Could probably toss this into a function somewhere, and/or
|
||||||
|
// have multiple simple animations for it.
|
||||||
for x in 0..MAPWIDTH {
|
for x in 0..MAPWIDTH {
|
||||||
let top_idx = map.xy_idx(x as i32, row);
|
let idx;
|
||||||
let bottom_idx = map.xy_idx(x as i32, (MAPHEIGHT as i32 - 1) - row);
|
if x % 2 == 0 {
|
||||||
if !cursed {
|
idx = map.xy_idx(x as i32, row);
|
||||||
map.revealed_tiles[top_idx] = true;
|
|
||||||
map.revealed_tiles[bottom_idx] = true;
|
|
||||||
} else {
|
} else {
|
||||||
map.revealed_tiles[top_idx] = false;
|
idx = map.xy_idx(x as i32, (MAPHEIGHT as i32 - 1) - (row));
|
||||||
map.revealed_tiles[bottom_idx] = false;
|
}
|
||||||
|
if !cursed {
|
||||||
|
map.revealed_tiles[idx] = true;
|
||||||
|
} else {
|
||||||
|
map.revealed_tiles[idx] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,7 +345,7 @@ impl GameState for State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if row as usize == MAPHEIGHT / 2 {
|
if row as usize == MAPHEIGHT - 1 {
|
||||||
new_runstate = RunState::MonsterTurn;
|
new_runstate = RunState::MonsterTurn;
|
||||||
} else {
|
} else {
|
||||||
new_runstate = RunState::MagicMapReveal { row: row + 1, cursed: cursed };
|
new_runstate = RunState::MagicMapReveal { row: row + 1, cursed: cursed };
|
||||||
|
|
@ -366,7 +370,6 @@ fn main() -> rltk::BError {
|
||||||
let mut context = RltkBuilder::new()
|
let mut context = RltkBuilder::new()
|
||||||
.with_title("rust-rl")
|
.with_title("rust-rl")
|
||||||
.with_dimensions(DISPLAYWIDTH, DISPLAYHEIGHT)
|
.with_dimensions(DISPLAYWIDTH, DISPLAYHEIGHT)
|
||||||
.with_fullscreen(true)
|
|
||||||
.with_tile_dimensions(16, 16)
|
.with_tile_dimensions(16, 16)
|
||||||
.with_resource_path("resources/")
|
.with_resource_path("resources/")
|
||||||
.with_font("terminal8x8.jpg", 8, 8)
|
.with_font("terminal8x8.jpg", 8, 8)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue