--- a/src/proto2/GameState.hh Thu Nov 20 23:05:07 2008 +0000
+++ b/src/proto2/GameState.hh Thu Nov 20 23:20:44 2008 +0000
@@ -10,7 +10,7 @@
// in cells/kg
const uint16_t MAP_WIDTH = 800;
const uint16_t MAP_HEIGHT = 600;
-const float MAP_GRAVITY = 100.0;
+const float MAP_GRAVITY = 1200.0;
const float PLAYER_MASS = 10.0;
const float PLAYER_MOVE_FORCE = 5000.0;
const float PLAYER_INITIAL_X = 400.0;
--- a/src/proto2/Graphics.cc Thu Nov 20 23:05:07 2008 +0000
+++ b/src/proto2/Graphics.cc Thu Nov 20 23:20:44 2008 +0000
@@ -12,18 +12,17 @@
Vector tmp;
CL_Color color;
- Engine::log(DEBUG, "Graphics") << "Mui.";
CL_PixelBuffer terr(MAP_WIDTH, MAP_HEIGHT, 3*MAP_WIDTH, CL_PixelFormat::rgb888);
for (tmp.x = 0; tmp.x < MAP_WIDTH; tmp.x++) {
for (tmp.y = 0; tmp.y < MAP_HEIGHT; tmp.y++) {
if (state.getType(tmp) == EMPTY) {
- color = CL_Color::white;
+ color = CL_Color(80, 35, 0);
} else if (state.getType(tmp) == DIRT) {
- color = CL_Color::brown;
+ color = CL_Color(144, 82, 23);
} else if (state.getType(tmp) == ROCK) {
- color = CL_Color::grey;
+ color = CL_Color(132, 136, 135);
} else {
// Fale
}
@@ -32,7 +31,7 @@
}
terrain = CL_Surface(terr);
- Engine::log(DEBUG, "Graphics") << "Tällä ollaan.";
+ Engine::log(DEBUG, "Graphics") << "Taalla ollaan.";
// connect timer signal
slots.connect(update_timer.sig_timer(), this, &Graphics::on_update);
--- a/src/proto2/Physics.cc Thu Nov 20 23:05:07 2008 +0000
+++ b/src/proto2/Physics.cc Thu Nov 20 23:20:44 2008 +0000
@@ -7,7 +7,9 @@
#include <cmath>
PhysicsWorld::PhysicsWorld (Vector gravity, Vector dimensions)
- : tick_timer(PHYSICS_TICK_MS), gravity(gravity), dimensions(dimensions), terrain(dimensions.x, std::vector<TerrainType>(dimensions.y, DIRT)) {
+ : tick_timer(PHYSICS_TICK_MS), gravity(gravity), dimensions(dimensions), terrain(dimensions.x, std::vector<TerrainType>(dimensions.y, EMPTY)) {
+
+ generateTerrain(1337);
slots.connect(tick_timer.sig_timer(), this, &PhysicsWorld::tick);
tick_timer.enable();
@@ -53,7 +55,7 @@
Vector newPosition = posAfterTick /*+ (velAfterTick * PHYSICS_TICK_MS)/1000*/;
this->velocity = velAfterTick;
- Engine::log(DEBUG, "PhysicsObject.updatePosition") << "Nopeus: "<<this->velocity;
+ //Engine::log(DEBUG, "PhysicsObject.updatePosition") << "Nopeus: "<<this->velocity;
/*
this->velocity += world.gravity * (PHYSICS_TICK_MS / 1000.0);
@@ -194,7 +196,7 @@
// some constants to control random generation
const int min_range = 10;
const int max_range = 40;
- const int num = 30;
+ const int num = 1;
const int rock_rarity = 4; // 1 / rock_rarity will be rock circle
// loops for amount of circles
@@ -202,16 +204,17 @@
// information of new circle
int midx = rand()%(int)dimensions.x;
int midy = rand()%(int)dimensions.y;
+ int range = rand()%(max_range-min_range)+min_range;
// put first circle in the middle of the cave
// so that we have some area we can certainly spawn into
if(i == 0) {
- midx = dimensions.x / 2;
- midy = dimensions.y / 2;
+ midx = 60;
+ midy = 60;
+ range = 50;
}
- int range = rand()%(max_range-min_range)+min_range;
- TerrainType type = EMPTY;
+ TerrainType type = DIRT;
if(rand()%rock_rarity == 0) {
type = ROCK;
}
--- a/src/proto2/Physics.hh Thu Nov 20 23:05:07 2008 +0000
+++ b/src/proto2/Physics.hh Thu Nov 20 23:20:44 2008 +0000
@@ -59,6 +59,10 @@
// or firmly on the ground. Affects to physics.
bool inAir;
+ // Shape of the object.
+ // //TODO
+ std::vector<Vector> edges;
+
// Force queue that is emptied on every tick
std::queue<Force> forceq;
Vector posAfterTick;