fps_timer.init(true);
frame_timer.init(true);
+ delete world;
+
if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE)
{
world = new World(subset);
#include "defines.h"
#include "scene.h"
#include "tile.h"
+#include "sprite.h"
#include "screen.h"
Surface* tux_life;
Surface* smalltux_stand_left;
Surface* smalltux_stand_right;
-Surface* bigtux_right[3];
-Surface* bigtux_left[3];
-Surface* bigtux_right_jump;
-Surface* bigtux_left_jump;
+Sprite* bigtux_right;
+Sprite* bigtux_left;
+Sprite* bigtux_right_jump;
+Sprite* bigtux_left_jump;
Surface* ducktux_right;
Surface* ducktux_left;
Surface* skidtux_right;
{
if (!skidding_timer.started())
{
- if (!jumping || physic.get_velocity_y() > 0)
+ if (physic.get_velocity_y() == 0)
{
if (dir == RIGHT)
- {
- bigtux_right[frame_]->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigtux_right->draw(base.x- scroll_x - 8, base.y);
else
- {
- bigtux_left[frame_]->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigtux_left->draw(base.x- scroll_x - 8, base.y);
}
else
{
if (dir == RIGHT)
- {
- bigtux_right_jump->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigtux_right_jump->draw(base.x- scroll_x - 8, base.y);
else
- {
- bigtux_left_jump->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigtux_left_jump->draw(base.x- scroll_x - 8, base.y);
}
}
else
{
if (dir == RIGHT)
- {
- skidtux_right->draw(
- base.x- scroll_x - 8, base.y);
- }
+ skidtux_right->draw(base.x- scroll_x - 8, base.y);
else
- {
- skidtux_left->draw(
- base.x- scroll_x - 8, base.y);
- }
+ skidtux_left->draw(base.x- scroll_x - 8, base.y);
}
}
else
void player_input_init(player_input_type* pplayer_input);
+class Sprite;
+
extern Surface* tux_life;
extern std::vector<Surface*> tux_right;
extern std::vector<Surface*> tux_left;
extern Surface* smalltux_jump_right;
extern Surface* smalltux_stand_left;
extern Surface* smalltux_stand_right;
-extern Surface* bigtux_right[3];
-extern Surface* bigtux_left[3];
-extern Surface* bigtux_right_jump;
-extern Surface* bigtux_left_jump;
+extern Sprite* bigtux_right;
+extern Sprite* bigtux_left;
+extern Sprite* bigtux_right_jump;
+extern Sprite* bigtux_left_jump;
extern Surface* ducktux_right;
extern Surface* ducktux_left;
extern Surface* skidtux_right;
cape_left[1] = new Surface(datadir + "/images/shared/cape-left-1.png",
USE_ALPHA);
- bigtux_right[0] = new Surface(datadir + "/images/shared/bigtux-right-0.png",
- USE_ALPHA);
-
- bigtux_right[1] = new Surface(datadir + "/images/shared/bigtux-right-1.png",
- USE_ALPHA);
-
- bigtux_right[2] = new Surface(datadir + "/images/shared/bigtux-right-2.png",
- USE_ALPHA);
-
- bigtux_right_jump = new Surface(datadir + "/images/shared/bigtux-right-jump.png", USE_ALPHA);
-
- bigtux_left[0] = new Surface(datadir + "/images/shared/bigtux-left-0.png",
- USE_ALPHA);
-
- bigtux_left[1] = new Surface(datadir + "/images/shared/bigtux-left-1.png",
- USE_ALPHA);
-
- bigtux_left[2] = new Surface(datadir + "/images/shared/bigtux-left-2.png",
- USE_ALPHA);
+ bigtux_right = sprite_manager->load("largetux-walk-right");
+ bigtux_left = sprite_manager->load("largetux-walk-left");
- bigtux_left_jump = new Surface(datadir + "/images/shared/bigtux-left-jump.png", USE_ALPHA);
+ bigtux_left_jump = sprite_manager->load("largetux-jump-left");
+ bigtux_right_jump = sprite_manager->load("largetux-jump-right");
bigcape_right[0] = new Surface(datadir + "/images/shared/bigcape-right-0.png",
USE_ALPHA);
{
delete tux_right[i];
delete tux_left[i];
- delete bigtux_right[i];
- delete bigtux_left[i];
}
delete bigtux_right_jump;
#include <SDL_mixer.h>
/* variables for stocking the sound and music */
-extern Mix_Chunk * sounds[NUM_SOUNDS];
-extern Mix_Music * level_song, * level_song_fast, * herring_song;
+extern Mix_Chunk* sounds[NUM_SOUNDS];
+extern Mix_Music* level_song;
+extern Mix_Music* level_song_fast;
+extern Mix_Music* herring_song;
/* functions handling the sound and music */
int open_audio(int frequency, Uint16 format, int channels, int chunksize);