projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
play sound when willowisp is caught
[supertux.git]
/
src
/
object
/
scripted_object.cpp
diff --git
a/src/object/scripted_object.cpp
b/src/object/scripted_object.cpp
index
591053d
..
eadcc43
100644
(file)
--- a/
src/object/scripted_object.cpp
+++ b/
src/object/scripted_object.cpp
@@
-79,7
+79,7
@@
ScriptedObject::set_pos(float x, float y)
{
printf("SetPos: %f %f\n", x, y);
bbox.set_pos(Vector(x, y));
{
printf("SetPos: %f %f\n", x, y);
bbox.set_pos(Vector(x, y));
- physic
= Physic
();
+ physic
.reset
();
}
float
}
float
@@
-104,13
+104,13
@@
ScriptedObject::set_velocity(float x, float y)
float
ScriptedObject::get_velocity_x()
{
float
ScriptedObject::get_velocity_x()
{
- return physic.
vx
;
+ return physic.
get_velocity_x()
;
}
float
ScriptedObject::get_velocity_y()
{
}
float
ScriptedObject::get_velocity_y()
{
- return physic.
vy
;
+ return physic.
get_velocity_y()
;
}
void
}
void
@@
-168,8
+168,7
@@
ScriptedObject::update(float elapsed_time)
return;
if(new_vel_set) {
return;
if(new_vel_set) {
- physic.vx = new_vel.x;
- physic.vy = new_vel.y;
+ physic.set_velocity(new_vel.x, new_vel.y);
new_vel_set = false;
}
movement = physic.get_movement(elapsed_time);
new_vel_set = false;
}
movement = physic.get_movement(elapsed_time);
@@
-191,14
+190,14
@@
ScriptedObject::collision_solid(const CollisionHit& hit)
return;
if(hit.bottom) {
return;
if(hit.bottom) {
- if(physic.
vy
> 0)
- physic.
vy = 0
;
+ if(physic.
get_velocity_y()
> 0)
+ physic.
set_velocity_y(0)
;
} else if(hit.top) {
} else if(hit.top) {
- physic.
vy = .1
;
+ physic.
set_velocity_y(.1f)
;
}
if(hit.left || hit.right) {
}
if(hit.left || hit.right) {
- physic.
vx = 0
;
+ physic.
set_velocity_x(0)
;
}
}
}
}