~yujiri/roguelike

36f441d79056699ad6a1831a820406af02de4b9c — Evin Yulo 9 months ago ca91f54 master
fix player positioning
4 files changed, 9 insertions(+), 16 deletions(-)

M client/Cargo.toml
M client/src/battle/state.rs
M common/Cargo.toml
M server/Cargo.toml
M client/Cargo.toml => client/Cargo.toml +1 -1
@@ 7,7 7,7 @@ default-run = "roguelike-client"
[dependencies]
sdl2 = { version = "0.35.2", features = ["gfx", "image", "ttf"] }
serde = { version = "1.0.160", features = ["derive"] }
postcard = { version = "1.0.0", features = ["alloc"] }
postcard = { version = "1.0.4", features = ["alloc"] }
rand = "0.8.5"
sodiumoxide = "0.2.7"
roguelike-common = { path = "../common" }

M client/src/battle/state.rs => client/src/battle/state.rs +6 -13
@@ 10,8 10,12 @@ pub struct State {
impl State {
	pub fn new(run: &Run) -> Self {
		let mut entities = vec![];
		for player in &run.players {
			entities.push(RefCell::new(Entity::from_character(player)));
		let player_spacing = 100;
		let player_leftmost = 0 - 50 * run.players.len();
		for (i, player) in run.players.iter().enumerate() {
			let mut entity = Entity::from_character(player);
			entity.pos = Pos{y: 300.0, x: (player_leftmost + player_spacing * i) as f32 };
			entities.push(RefCell::new(entity));
		}
		let mut enemy_1 = Entity::from_character(&Character{
			id: random::<Id>(),


@@ 24,17 28,6 @@ impl State {
		enemy_1.enemy = true;
		enemy_1.pos = Pos{x: 0.0, y: -100.0};
		entities.push(RefCell::new(enemy_1));
		let mut ally_1 = Entity::from_character(&Character{
			id: random::<Id>(),
			name: "BLAH".to_string(),
			health: HITS_TO_KILL,
			owned: vec![OwnedItem{equipped: true, item: SNIPE}],
			capacity: 3,
		});
		ally_1.ai = true;
		ally_1.enemy = false;
		ally_1.pos = Pos{x: 100.0, y: 0.0};
		entities.push(RefCell::new(ally_1));
		Self{entities}
	}
	pub fn finalize(&self, run: &mut Run) {

M common/Cargo.toml => common/Cargo.toml +1 -1
@@ 5,5 5,5 @@ edition = "2021"

[dependencies]
serde = { version = "1.0.160", features = ["derive"] }
postcard = { version = "1.0.0", features = ["alloc"] }
postcard = { version = "1.0.4", features = ["alloc"] }
sodiumoxide = "0.2.7"

M server/Cargo.toml => server/Cargo.toml +1 -1
@@ 4,6 4,6 @@ version = "0.1.0"
edition = "2021"

[dependencies]
postcard = { version = "1.0.0", features = ["alloc"] }
postcard = { version = "1.0.4", features = ["alloc"] }
sodiumoxide = "0.2.7"
roguelike-common = { path = "../common" }