--- a/src/Config.hh Fri Dec 05 06:28:25 2008 +0000
+++ b/src/Config.hh Fri Dec 05 11:11:38 2008 +0000
@@ -32,7 +32,7 @@
const float CROSSHAIR_ANGLE_SPEED = PI/40;
const float PLAYER_MAX_SPEED = 130;
-const float PLAYER_WALK_SPEED = 130;
+const float PLAYER_WALK_SPEED = 100;
const float PLAYER_COLLISION_ELASTICITY = 0.3; // TODO: This could be
// different for different
--- a/src/PhysicsObject.cc Fri Dec 05 06:28:25 2008 +0000
+++ b/src/PhysicsObject.cc Fri Dec 05 11:11:38 2008 +0000
@@ -203,7 +203,7 @@
if(!possibleLocation(reached)) {
- Engine::log(DEBUG, "PhysicsObject.updatePosition") << "logic error reached should not be possible to be impossible.. diffVec: " << diffVec;
+ Engine::log(DEBUG, "PhysicsObject.updatePosition") << "inside ground. diffVec: " << diffVec;
func1();
}
@@ -216,18 +216,11 @@
}
} else {
newPosition = reached;
+ this->position = newPosition;
onCollision();
//TODO: It should be moved before onCollision, for Shots
}
- if(!possibleLocation(newPosition)) {
- Engine::log(DEBUG, "great failure") << "great failure";
- func1();
- }
this->position = newPosition;
- if(!possibleLocation(position)) {
- Engine::log(DEBUG, "great failure") << "great failure";
- func1();
- }
// Engine::log(DEBUG, "PhysicsObject.updatePosition") << "Pos: " << this->position;
}
--- a/src/Player.cc Fri Dec 05 06:28:25 2008 +0000
+++ b/src/Player.cc Fri Dec 05 11:11:38 2008 +0000
@@ -38,13 +38,14 @@
// here should be somehow considered which projectile it is
if(!canShoot())
return;
- reloadTimer += 0;
+ reloadTimer += 50;
Vector unitVectorAim = facingRight ? Vector(std::cos(aim), -std::sin(aim)) :
Vector(-std::cos(aim), -std::sin(aim));
float shotspeed = 100*PHYSICS_TICK_MS/2;
Vector shotRelativeVelocity = unitVectorAim * shotspeed;
Vector shotVelocity = this->velocity + shotRelativeVelocity;
- new Projectile(this->state, this->position, shotVelocity, true, 20);
+ Vector shotPosition = this->position + unitVectorAim*10;
+ new Projectile(this->state, shotPosition, shotVelocity, true, 20);
}
void LocalPlayer::handleMove (PlayerInput_Move input) {
--- a/src/Projectile.cc Fri Dec 05 06:28:25 2008 +0000
+++ b/src/Projectile.cc Fri Dec 05 11:11:38 2008 +0000
@@ -4,13 +4,14 @@
Projectile::Projectile(GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age) :
PhysicsObject(state.world, PLAYER_MASS, position, velocity), state(state), visible(visible), radius(radius), destroyed(false), age(age) {
birth_tick = world.tick_timer.get_ticks();
- // Looks kind of dumb, for ammunition to have shape
+ // Don't think these are needed anymore
std::vector<Vector> shape(4);
shape[0] = Vector(-1, -1);
shape[1] = Vector(-1, 1);
shape[2] = Vector(1, 1);
shape[3] = Vector(1, -1);
setShape(shape);
+
target_visible = false;
collision_elasticity = 0.9; // = shotType.elasticity
world.addProjectile(this);
@@ -22,11 +23,11 @@
this->destroyed = true;
}
-bool Projectile::isDestroyed (void) {
+bool Projectile::isDestroyed (void) const {
return this->destroyed;
}
-void Projectile::draw(CL_GraphicContext *gc) {
+void Projectile::draw(CL_GraphicContext *gc) const {
if (visible) {
CL_Quad projectile(
--- a/src/Projectile.hh Fri Dec 05 06:28:25 2008 +0000
+++ b/src/Projectile.hh Fri Dec 05 11:11:38 2008 +0000
@@ -22,8 +22,8 @@
Projectile(GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age=1000000000);
~Projectile() {};
- bool isDestroyed (void);
- virtual void draw(CL_GraphicContext *gc);
+ bool isDestroyed (void) const;
+ virtual void draw(CL_GraphicContext *gc) const;
private:
virtual void onCollision();
};