diff options
-rw-r--r-- | scene.cpp | 13 | ||||
-rw-r--r-- | scene.h | 1 |
2 files changed, 10 insertions, 4 deletions
@@ -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") @@ -29,6 +29,7 @@ class Scene { bool render_terrain; bool gravity; bool dialog; + bool flying; Terrain::Node *last_node; |