projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some more aspect ratio stuff
[supertux.git]
/
src
/
badguy
/
fish.cpp
diff --git
a/src/badguy/fish.cpp
b/src/badguy/fish.cpp
index
43ceb5e
..
93898d4
100644
(file)
--- a/
src/badguy/fish.cpp
+++ b/
src/badguy/fish.cpp
@@
-30,13
+30,13
@@
static const float FISH_WAIT_TIME = 1;
Fish::Fish(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0)
{
Fish::Fish(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0)
{
- physic.
gravity_enabled = true
;
+ physic.
enable_gravity(true)
;
}
Fish::Fish(const Vector& pos)
: BadGuy(pos, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0)
{
}
Fish::Fish(const Vector& pos)
: BadGuy(pos, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0)
{
- physic.
gravity_enabled = true
;
+ physic.
enable_gravity(true)
;
}
void
}
void
@@
-75,7
+75,7
@@
HitResponse
Fish::hit(const CollisionHit& hit)
{
if(hit.top) {
Fish::hit(const CollisionHit& hit)
{
if(hit.top) {
- physic.
vy = 0
;
+ physic.
set_velocity_y(0)
;
}
return CONTINUE;
}
return CONTINUE;
@@
-84,7
+84,7
@@
Fish::hit(const CollisionHit& hit)
void
Fish::collision_tile(uint32_t tile_attributes)
{
void
Fish::collision_tile(uint32_t tile_attributes)
{
- if ((tile_attributes & Tile::WATER) && (physic.
vy
>= 0)) {
+ if ((tile_attributes & Tile::WATER) && (physic.
get_velocity_y()
>= 0)) {
// initialize stop position if uninitialized
if (stop_y == 0) stop_y = get_pos().y + get_bbox().get_height();
// initialize stop position if uninitialized
if (stop_y == 0) stop_y = get_pos().y + get_bbox().get_height();
@@
-111,13
+111,13
@@
Fish::active_update(float elapsed_time)
// set sprite
if(!frozen)
// set sprite
if(!frozen)
- sprite->set_action(physic.
vy
< 0 ? "normal" : "down");
+ sprite->set_action(physic.
get_velocity_y()
< 0 ? "normal" : "down");
// we can't afford flying out of the tilemap, 'cause the engine would remove us.
if ((get_pos().y - 31.8) < 0) // too high, let us fall
{
// we can't afford flying out of the tilemap, 'cause the engine would remove us.
if ((get_pos().y - 31.8) < 0) // too high, let us fall
{
- physic.
vy = 0
;
- physic.
gravity_enabled = true
;
+ physic.
set_velocity_y(0)
;
+ physic.
enable_gravity(true)
;
}
}
}
}
@@
-125,24
+125,24
@@
void
Fish::start_waiting()
{
waiting.start(FISH_WAIT_TIME);
Fish::start_waiting()
{
waiting.start(FISH_WAIT_TIME);
- set_
group
(COLGROUP_DISABLED);
- physic.
gravity_enabled = false
;
- physic.
vy = 0
;
+ set_
colgroup_active
(COLGROUP_DISABLED);
+ physic.
enable_gravity(false)
;
+ physic.
set_velocity_y(0)
;
}
void
Fish::jump()
{
}
void
Fish::jump()
{
- physic.
vy = FISH_JUMP_POWER
;
- physic.
gravity_enabled = true
;
- set_
group
(COLGROUP_MOVING);
+ physic.
set_velocity_y(FISH_JUMP_POWER)
;
+ physic.
enable_gravity(true)
;
+ set_
colgroup_active
(COLGROUP_MOVING);
}
void
Fish::freeze()
{
BadGuy::freeze();
}
void
Fish::freeze()
{
BadGuy::freeze();
- sprite->set_action(physic.
vy
< 0 ? "iced" : "iced-down");
+ sprite->set_action(physic.
get_velocity_y()
< 0 ? "iced" : "iced-down");
waiting.stop();
}
waiting.stop();
}