summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene.cpp13
-rw-r--r--scene.h1
2 files changed, 10 insertions, 4 deletions
diff --git a/scene.cpp b/scene.cpp
index c55c2dc..059e2ca 100644
--- a/scene.cpp
+++ b/scene.cpp
@@ -20,6 +20,7 @@ Scene::Scene() {
normals = false;
render_terrain = true;
gravity = true;
+ flying = true;
last_node = NULL;
@@ -185,7 +186,10 @@ void Scene::events() {
render_terrain = !render_terrain;
break;
case SDLK_SPACE:
- yvel = .05;
+ if(!flying) {
+ yvel = .02;
+ flying = true;
+ }
break;
case SDLK_h:
gravity = !gravity;
@@ -335,13 +339,14 @@ void Scene::render() {
if(gravity) {
float y = node->get_height(pos.x, pos.z);
if(pos.y > y && !keystate[SDLK_e])
- yvel -= 9.81 * steps / 85000;
- if(yvel < -.5)
- yvel = -.5;
+ yvel -= 9.81 / 200000. * steps;
+ if(yvel < -.1)
+ yvel = -.1;
pos.y += yvel * steps;
if(pos.y < y) {
pos.y = y;
yvel = 0;
+ flying = false;
}
}
move_str = (boost::format("%s n: %.2f,%.2f c: %d,%d %dx%d")
diff --git a/scene.h b/scene.h
index 9e3ddb7..7b6808c 100644
--- a/scene.h
+++ b/scene.h
@@ -29,6 +29,7 @@ class Scene {
bool render_terrain;
bool gravity;
bool dialog;
+ bool flying;
Terrain::Node *last_node;