Skip to content

Commit

Permalink
changed life form size to be LIFE_FORM_SIZE constant across app
Browse files Browse the repository at this point in the history
  • Loading branch information
craigmayhew committed Jun 27, 2020
1 parent 11503ea commit 9a5a39e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use crate::systems::life;

pub const ARENA_HEIGHT: f32 = 1000.0;
pub const ARENA_WIDTH: f32 = 1000.0;
pub const LIFE_FORM_SIZE: f32 = 150.0;

fn initialise_lifeforms(world: &mut World) {
//// 3d tetra
Expand Down Expand Up @@ -70,15 +71,14 @@ fn initialise_lifeforms(world: &mut World) {
let mut transform = Transform::default();

//set size of tetrahedrons
let life_form_size = 150.0;
let scale = Vector3::new(life_form_size, life_form_size, life_form_size);
let scale = Vector3::new(LIFE_FORM_SIZE, LIFE_FORM_SIZE, LIFE_FORM_SIZE);
transform.set_scale(scale);

//render some tetrahedrons!
for x in 1..5 {
for y in 1..5 {
for z in 1..5 {
transform.set_translation_xyz(life_form_size * x as f32, life_form_size * y as f32, life_form_size * z as f32);
transform.set_translation_xyz(LIFE_FORM_SIZE * x as f32, LIFE_FORM_SIZE * y as f32, LIFE_FORM_SIZE * z as f32);
let translation = transform.translation();
// Create a life form entity.
world
Expand Down
2 changes: 1 addition & 1 deletion src/systems/life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<'s> System<'s> for LifeSystem {
if &name.name[..9] == "Life Form" && (entities_count < 2 || total_entities-entities_count<3) {

let mut transform_new_life = transform.clone();
transform_new_life.append_translation_xyz(0.0, 0.0, -15.0);
transform_new_life.append_translation_xyz(0.0, 0.0, -crate::LIFE_FORM_SIZE);

lazy_update.exec(move |world| {
//loading tetra mesh
Expand Down

0 comments on commit 9a5a39e

Please sign in to comment.