// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include <math.h>
+#include <cmath>
#include <iostream>
#include <cassert>
+
#include "gameloop.h"
-#include "globals.h"
+#include "app/globals.h"
#include "player.h"
#include "defines.h"
#include "scene.h"
#include "tile.h"
-#include "sprite.h"
+#include "special/sprite.h"
#include "sector.h"
#include "tilemap.h"
#include "camera.h"
#include "gameobjs.h"
#include "resources.h"
#include "interactive_object.h"
-#include "screen/screen.h"
+#include "video/screen.h"
// behavior definitions:
#define TILES_FOR_BUTTJUMP 3
if(dying == DYING_NOT)
handle_input();
- physic.apply(elapsed_time, base.x, base.y);
+ physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
if(dying == DYING_NOT)
{
if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) {
if(fabs(vx)>SKID_XM && !skidding_timer.check()) {
skidding_timer.start(SKID_TIME);
- sound_manager->play_sound(sounds[SND_SKID]);
+ SoundManager::get()->play_sound(IDToSound(SND_SKID));
ax *= 2.5;
} else {
ax *= 2;
jumping = true;
can_jump = false;
if (size == SMALL)
- sound_manager->play_sound(sounds[SND_JUMP]);
+ SoundManager::get()->play_sound(IDToSound(SND_JUMP));
else
- sound_manager->play_sound(sounds[SND_BIGJUMP]);
+ SoundManager::get()->play_sound(IDToSound(SND_BIGJUMP));
}
// Let go of jump key
else if(input.up == UP && jumping && physic.get_velocity_y() > 0)
if(player_status.lives < MAX_LIVES)
++player_status.lives;
/*We want to hear the sound even, if MAX_LIVES is reached*/
- sound_manager->play_sound(sounds[SND_LIFEUP]);
+ SoundManager::get()->play_sound(IDToSound(SND_LIFEUP));
}
}
if(dying)
return;
- sound_manager->play_sound(sounds[SND_HURT]);
+ SoundManager::get()->play_sound(IDToSound(SND_HURT));
physic.set_velocity_x(0);
}
}
+void
+Player::bounce(BadGuy* badguy)
+{
+ if (input.up)
+ physic.set_velocity_y(5.2);
+ else
+ physic.set_velocity_y(2);
+
+ // Move the player a little bit above the badguy to avoid collision
+ // between badguy and player directly after the bounce has happend
+ base.y = badguy->base.y - base.height - 2;
+}
+
+/* EOF */
+