Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/example')
-rw-r--r--src/game/example/example.cc10
-rw-r--r--src/game/example/spectator.cc18
2 files changed, 14 insertions, 14 deletions
diff --git a/src/game/example/example.cc b/src/game/example/example.cc
index 9d4c1ed..f368556 100644
--- a/src/game/example/example.cc
+++ b/src/game/example/example.cc
@@ -43,9 +43,9 @@ Example::Example() : core::Module("The Osirion Project Example", true)
cube->set_label("cube");
cube->set_name("The Red Cube");
cube->entity_shape = core::Entity::Cube; // set the shape to cube
- cube->get_location().assign(16, -8, 0); // set location
+ cube->get_location().assign(16, -8, 0); // set location
cube->get_color().assign(1, 0, 0); // set RGB color red
- cube->entity_radius = 0.25f; // set radius, in game units
+ cube->set_radius(0.25f); // set radius, in game units
cube->set_zone(zone); // add the entity to the zone
core::Entity *sphere = new core::Entity(); // a new entity
@@ -54,7 +54,7 @@ Example::Example() : core::Module("The Osirion Project Example", true)
sphere->entity_shape = core::Entity::Sphere; // set the shape to sphere
sphere->get_location().assign(16, 0, 0); // set location
sphere->get_color().assign(0, 1, 0); // set RGB color green
- sphere->entity_radius = 0.25f; // set radius, in game units
+ cube->set_radius(0.25f); // set radius, in game units
sphere->set_zone(zone); // add the entity to the zone
core::Entity *diamond = new core::Entity(); // a new entity
@@ -63,7 +63,7 @@ Example::Example() : core::Module("The Osirion Project Example", true)
diamond->entity_shape = core::Entity::Diamond; // set the shape to cube
diamond->get_location().assign(16, 8, 0); // set location
diamond->get_color().assign(0, 0, 1); // set RGB color blue
- diamond->entity_radius = 0.25f; // set radius, in game units
+ cube->set_radius(0.25f); // set radius, in game units
diamond->set_zone(zone); // add the entity to the zone
core::Entity *axis = new core::Entity(); // a new entity
@@ -73,7 +73,7 @@ Example::Example() : core::Module("The Osirion Project Example", true)
axis->get_location().assign(0, 0, 0); // set location
axis->get_color().assign(1); // set greyscale color white
axis->get_color_second().assign(0.5f, 0.0f, 0.5f); // set RGB secondary color
- axis->entity_radius = 0.25f; // set radius, in game units
+ cube->set_radius(0.25f); // set radius, in game units
axis->set_zone(zone); // add the entity to the zone
}
diff --git a/src/game/example/spectator.cc b/src/game/example/spectator.cc
index a2c4353..5fad0f1 100644
--- a/src/game/example/spectator.cc
+++ b/src/game/example/spectator.cc
@@ -15,11 +15,11 @@ Spectator::Spectator(core::Player *owner) : core::EntityControlable(owner)
{
// default properties
entity_shape = core::Entity::Diamond;
- entity_radius = 0.25f;
+ set_radius(0.25f);
// the spectator gets player color
- entity_color.assign(owner->color());
- entity_color_second.assign(owner->color_second());
+ get_color().assign(owner->color());
+ get_color_second().assign(owner->color_second());
// set dirty flag
set_dirty();
@@ -40,9 +40,9 @@ void Spectator::frame(float elapsed)
// rotate according to input
float rotation = g_spectatorrotation->value() * elapsed;
- entity_axis.change_direction(target_direction * rotation);
- entity_axis.change_pitch(target_pitch * rotation);
- entity_axis.change_roll(target_roll * rotation);
+ get_axis().change_direction(target_direction * rotation);
+ get_axis().change_pitch(target_pitch * rotation);
+ get_axis().change_roll(target_roll * rotation);
// assign speed from thruster
float maxspeed = g_spectatorspeed->value();
@@ -50,13 +50,13 @@ void Spectator::frame(float elapsed)
// assign new location
if (entity_speed)
- entity_location += entity_axis.forward() * entity_speed * elapsed;
+ get_location() += axis().forward() * entity_speed * elapsed;
if (target_afterburner)
- entity_location += entity_axis.forward() * maxspeed * target_afterburner * elapsed;
+ get_location() += axis().forward() * maxspeed * target_afterburner * elapsed;
if (target_strafe)
- entity_location += entity_axis.left() * maxspeed * target_strafe * elapsed;
+ get_location() += axis().left() * maxspeed * target_strafe * elapsed;
// set dirty flag
set_dirty();