projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- some more work on the new unisolid snow tiles and a test level
[supertux.git]
/
src
/
physic.cpp
diff --git
a/src/physic.cpp
b/src/physic.cpp
index
358b41c
..
5da55a3
100644
(file)
--- a/
src/physic.cpp
+++ b/
src/physic.cpp
@@
-23,7
+23,7
@@
#include "physic.hpp"
Physic::Physic()
#include "physic.hpp"
Physic::Physic()
- : ax(0), ay(0), vx(0), vy(0), gravity_enabled_flag(true)
+ : ax(0), ay(0), vx(0), vy(0), gravity_enabled_flag(true)
, gravity(10 * 100)
{
}
{
}
@@
-141,10
+141,22
@@
Physic::gravity_enabled() const
return gravity_enabled_flag;
}
return gravity_enabled_flag;
}
+void
+Physic::set_gravity(float gravity)
+{
+ this->gravity = gravity * 100;
+}
+
+float
+Physic::get_gravity() const
+{
+ return gravity / 100;
+}
+
Vector
Physic::get_movement(float elapsed_time)
{
Vector
Physic::get_movement(float elapsed_time)
{
- float grav = gravity_enabled_flag ?
1000
: 0;
+ float grav = gravity_enabled_flag ?
gravity
: 0;
Vector result(
vx * elapsed_time + ax * elapsed_time * elapsed_time,
Vector result(
vx * elapsed_time + ax * elapsed_time * elapsed_time,