projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made Mr_Tree graphic smaller, from 99 to 85 pixels.
[supertux.git]
/
src
/
badguy
/
yeti.cpp
diff --git
a/src/badguy/yeti.cpp
b/src/badguy/yeti.cpp
index
87faba0
..
10a33e0
100644
(file)
--- a/
src/badguy/yeti.cpp
+++ b/
src/badguy/yeti.cpp
@@
-22,12
+22,12
@@
#include <float.h>
#include <sstream>
#include <memory>
#include <float.h>
#include <sstream>
#include <memory>
-#include "yeti.h"
-#include "object/camera.h"
-#include "yeti_stalactite.h"
-#include "bouncing_snowball.h"
-#include "game_session.h"
-#include "scripting/script_interpreter.h"
+#include "yeti.h
pp
"
+#include "object/camera.h
pp
"
+#include "yeti_stalactite.h
pp
"
+#include "bouncing_snowball.h
pp
"
+#include "game_session.h
pp
"
+#include "scripting/script_interpreter.h
pp
"
static const float JUMP_VEL1 = 250;
static const float JUMP_VEL2 = 700;
static const float JUMP_VEL1 = 250;
static const float JUMP_VEL2 = 700;
@@
-43,12
+43,14
@@
Yeti::Yeti(const lisp::Lisp& reader)
reader.get("x", start_position.x);
reader.get("y", start_position.y);
bbox.set_size(80, 120);
reader.get("x", start_position.x);
reader.get("y", start_position.y);
bbox.set_size(80, 120);
- sprite = sprite_manager->create("
yeti
");
+ sprite = sprite_manager->create("
images/creatures/yeti/yeti.sprite
");
sprite->set_action("right");
state = INIT;
side = LEFT;
sprite->set_action("right");
state = INIT;
side = LEFT;
+#if 0
sound_manager->preload_sound("yeti_gna");
sound_manager->preload_sound("yeti_roar");
sound_manager->preload_sound("yeti_gna");
sound_manager->preload_sound("yeti_roar");
+#endif
hit_points = INITIAL_HITPOINTS;
reader.get("dead-script", dead_script);
countMe = false;
hit_points = INITIAL_HITPOINTS;
reader.get("dead-script", dead_script);
countMe = false;
@@
-62,7
+64,7
@@
void
Yeti::draw(DrawingContext& context)
{
// we blink when we are safe
Yeti::draw(DrawingContext& context)
{
// we blink when we are safe
- if(safe_timer.started() && size_t(g
lobal
_time*40)%2)
+ if(safe_timer.started() && size_t(g
ame
_time*40)%2)
return;
BadGuy::draw(context);
return;
BadGuy::draw(context);
@@
-87,8
+89,12
@@
Yeti::active_update(float elapsed_time)
case ANGRY_JUMPING:
if(timer.check()) {
// jump
case ANGRY_JUMPING:
if(timer.check()) {
// jump
- sound_manager->play
_sound("yeti_gna
");
+ sound_manager->play
("sounds/yeti_gna.wav
");
physic.set_velocity_y(JUMP_VEL1);
physic.set_velocity_y(JUMP_VEL1);
+ if (side == LEFT) // on the left, facing Tux who is on the right
+ sprite->set_action("jump-right");
+ else
+ sprite->set_action("jump-left");
}
break;
default:
}
break;
default:
@@
-102,6
+108,7
@@
void
Yeti::go_right()
{
// jump and move right
Yeti::go_right()
{
// jump and move right
+ sprite->set_action("right");
physic.set_velocity_y(JUMP_VEL1);
physic.set_velocity_x(RUN_SPEED);
state = GO_RIGHT;
physic.set_velocity_y(JUMP_VEL1);
physic.set_velocity_x(RUN_SPEED);
state = GO_RIGHT;
@@
-111,6
+118,7
@@
Yeti::go_right()
void
Yeti::go_left()
{
void
Yeti::go_left()
{
+ sprite->set_action("left");
physic.set_velocity_y(JUMP_VEL1);
physic.set_velocity_x(-RUN_SPEED);
state = GO_LEFT;
physic.set_velocity_y(JUMP_VEL1);
physic.set_velocity_x(-RUN_SPEED);
state = GO_LEFT;
@@
-139,7
+147,7
@@
Yeti::collision_squished(Player& player)
return true;
player.bounce(*this);
return true;
player.bounce(*this);
- sound_manager->play
_sound("yeti_roar
");
+ sound_manager->play
("sounds/yeti_roar.wav
");
hit_points--;
if(hit_points <= 0) {
sprite->set_action("dead");
hit_points--;
if(hit_points <= 0) {
sprite->set_action("dead");
@@
-164,8
+172,18
@@
Yeti::kill_fall()
}
void
}
void
-Yeti::write(lisp::Writer& )
+Yeti::write(lisp::Writer&
writer
)
{
{
+ writer.start_list("yeti");
+
+ writer.write_float("x", start_position.x);
+ writer.write_float("y", start_position.y);
+
+ if(dead_script != "") {
+ writer.write_string("dead-script", dead_script);
+ }
+
+ writer.end_list("yeti");
}
void
}
void
@@
-202,16
+220,20
@@
Yeti::collision_solid(GameObject& , const CollisionHit& hit)
} else if(state == GO_LEFT && !timer.started()) {
side = LEFT;
summon_snowball();
} else if(state == GO_LEFT && !timer.started()) {
side = LEFT;
summon_snowball();
- sprite->set_action("right");
+ sprite->set_action("
stand-
right");
angry_jumping();
} else if(state == GO_RIGHT && !timer.started()) {
side = RIGHT;
summon_snowball();
angry_jumping();
} else if(state == GO_RIGHT && !timer.started()) {
side = RIGHT;
summon_snowball();
- sprite->set_action("left");
+ sprite->set_action("
stand-
left");
angry_jumping();
} else if(state == ANGRY_JUMPING) {
if(!timer.started()) {
// we just landed
angry_jumping();
} else if(state == ANGRY_JUMPING) {
if(!timer.started()) {
// we just landed
+ if (side == LEFT) // standing on the left, facing Tux who is on the right
+ sprite->set_action("stand-right");
+ else
+ sprite->set_action("stand-left");
jumpcount++;
// make a stalactite falling down and shake camera a bit
Sector::current()->camera->shake(.1, 0, 10);
jumpcount++;
// make a stalactite falling down and shake camera a bit
Sector::current()->camera->shake(.1, 0, 10);