summaryrefslogtreecommitdiff
path: root/src/state.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-07-10 09:43:48 -0500
committertom barrett <spalf0@gmail.com>2019-07-10 09:43:48 -0500
commitced37025a37051db896443d310f5f613f1281882 (patch)
tree6faa646addcd2cfa1c49154a06846321a6e2e423 /src/state.rs
parent503361ce70615d7c4b66bd7e49d56c61259dab32 (diff)
animation now always works, added player spawn
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/state.rs b/src/state.rs
index db72d10..98ad422 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -26,13 +26,16 @@ impl State {
let tileset = Tileset::new(filesystem::open(context, "/tileset.tsx")?);
let map = Map::new(filesystem::open(context, "/map.tmx")?, &tileset);
- let map_dimensions = map.get_dimensions();
Ok(State {
map: map.clone(),
spritebatch: SpriteBatch::new(image),
- camera: Camera::new(context, map_dimensions),
- player: Player::new(&tileset, map_dimensions),
+ camera: Camera::new(context, map.get_dimensions()),
+ player: Player::new(
+ &tileset,
+ map.get_spawn_points("player")[0],
+ map.get_dimensions(),
+ ),
npcs: NPC::build_npcs(&tileset, &map),
})
}