-;; Generated with Windstille Editor
+;; Generated with Flexlay Editor
(supertux-worldmap
- (tilemap
- (width 20)
- (height 15)
- (data
- 9 9 9 9 9 11 16 12 11 16 16 16 16 12 9 9 9 9 9 9
- 9 9 11 16 16 22 19 17 15 48 40 40 39 23 16 12 9 9 9 9
- 9 9 15 20 18 18 18 13 15 47 19 19 37 40 39 23 16 12 9 9
- 9 11 22 17 11 16 16 16 22 47 48 40 40 40 44 39 19 23 16 12
- 9 15 19 23 22 48 40 40 40 44 46 48 39 19 19 47 19 19 19 17
- 9 15 48 39 19 41 40 40 40 40 42 47 47 19 19 47 19 20 18 13
- 9 15 37 45 40 45 40 40 40 40 43 42 37 40 40 42 19 17 9 9
- 9 15 19 47 19 47 19 19 48 40 42 19 24 25 25 25 26 17 9 9
- 9 14 21 37 40 46 19 48 42 19 24 25 33 32 35 29 28 17 9 9
- 9 9 15 19 19 37 40 42 24 25 33 35 29 29 28 20 18 13 9 9
- 9 9 15 19 19 24 25 25 33 32 35 28 20 18 18 13 9 9 9 9
- 9 9 14 21 19 31 32 32 32 35 28 20 13 9 9 11 16 12 9 9
- 9 9 9 14 21 30 29 29 29 28 20 13 9 11 16 22 20 13 9 9
- 9 9 9 9 14 18 18 18 18 18 13 9 9 14 18 18 13 9 9 9
- 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
- ))
- (levels
- (level (name "level1.stl") (x 3) (y 6))
- (level (name "level2.stl") (x 5) (y 8))
- (level (name "level3.stl") (x 9) (y 1)))
-
- )
+ (tilemap
+ (width 40)
+ (height 30)
+ (data
+ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
+ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 12 9 9 9 9 9 9 9 9 9 9 9 9
+ 9 9 9 9 9 9 9 11 16 12 11 16 16 16 16 12 9 9 9 9 11 16 16 12 9 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9
+ 9 9 9 11 16 16 16 22 19 17 15 24 25 25 26 23 16 12 9 9 14 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
+ 9 9 11 22 19 4 19 20 18 13 15 31 32 32 34 26 19 23 16 12 9 9 9 9 9 9 11 16 16 16 16 12 9 9 9 9 9 9 9 9
+ 9 9 15 19 48 42 20 13 9 9 15 31 35 29 29 28 19 19 19 23 16 12 9 9 9 11 22 19 24 25 26 23 12 11 16 16 12 9 9 9
+ 9 9 15 19 47 19 17 11 16 16 22 30 28 19 48 40 4 40 39 20 18 13 9 9 11 22 19 19 30 36 34 26 23 22 19 19 23 12 9 9
+ 9 9 15 19 4 19 23 22 19 19 19 19 24 26 47 19 19 19 47 23 16 16 16 16 22 48 4 40 39 31 32 34 25 25 25 25 26 17 9 9
+ 9 9 15 19 37 39 19 4 40 40 40 39 30 28 41 40 4 40 44 40 40 4 40 40 40 42 19 19 47 30 29 29 29 29 29 36 27 17 9 9
+ 9 9 15 19 19 47 19 47 24 25 26 4 40 40 4 24 25 25 26 20 18 18 18 21 24 25 25 26 4 40 40 4 40 40 39 31 27 23 12 9
+ 9 9 14 18 21 47 19 47 30 29 28 19 24 25 25 33 35 29 28 17 9 9 9 15 30 29 36 27 19 19 19 19 19 19 47 31 34 26 17 9
+ 9 9 9 9 15 4 40 4 19 19 24 25 33 35 29 29 28 20 18 13 9 9 9 14 18 21 31 27 48 4 40 40 40 40 4 30 36 27 17 9
+ 9 9 9 9 15 19 19 24 25 25 33 32 35 28 20 18 18 13 9 9 9 9 9 9 9 15 31 27 47 24 25 25 25 26 19 19 30 28 17 9
+ 9 9 9 9 14 21 19 31 32 32 32 35 28 20 13 9 9 11 16 12 9 9 9 9 9 15 30 28 4 30 36 32 35 28 20 21 19 20 13 9
+ 9 9 11 12 9 14 21 30 29 29 29 28 20 13 9 11 16 22 20 13 9 9 9 9 9 14 21 19 37 39 31 32 27 20 13 14 21 17 9 9
+ 9 9 14 13 11 12 14 18 18 18 18 18 13 9 9 14 18 18 13 9 9 9 9 9 9 9 14 21 19 47 30 36 27 17 9 9 14 13 9 9
+ 9 9 9 9 14 13 9 9 9 9 11 16 16 16 12 9 9 11 16 12 9 9 9 9 9 9 9 14 21 4 19 31 27 17 9 9 9 9 9 9
+ 9 9 9 9 9 9 9 11 16 16 22 24 25 26 23 16 16 22 19 23 16 16 12 9 9 9 9 9 15 47 19 30 28 17 9 9 9 9 9 9
+ 9 9 9 11 16 16 16 22 19 19 19 30 36 34 25 26 19 24 25 25 25 26 23 16 16 16 16 16 22 47 20 18 18 13 9 9 9 9 9 9
+ 9 9 9 15 24 25 26 19 19 19 19 19 30 29 29 28 19 30 29 29 36 34 25 26 19 19 48 4 40 42 17 9 9 9 9 9 9 9 9 9
+ 9 9 9 15 31 32 27 4 40 39 19 48 40 40 4 19 48 40 40 4 30 29 29 28 19 19 47 20 18 18 13 9 9 9 9 9 9 9 9 9
+ 9 9 9 15 30 36 34 26 19 47 19 47 19 19 47 19 47 19 19 47 19 19 19 48 40 40 42 23 12 9 9 9 9 11 12 9 9 9 9 9
+ 9 9 9 14 21 30 29 28 19 37 4 42 19 19 47 19 47 19 19 47 19 19 19 4 19 19 24 26 17 9 9 9 9 14 13 9 9 9 9 9
+ 9 9 9 9 14 18 18 18 21 19 19 19 19 19 47 19 47 19 4 42 19 19 48 42 24 25 33 27 17 9 9 9 9 9 9 9 9 9 9 9
+ 9 9 9 9 9 9 9 9 14 21 19 24 25 26 4 40 42 19 47 19 19 19 47 19 30 29 36 27 17 9 9 9 9 9 9 9 9 9 9 9
+ 9 9 9 11 12 9 9 9 9 14 21 30 36 34 25 26 19 19 37 40 4 40 42 19 20 21 30 28 17 9 9 11 16 16 12 9 9 9 9 9
+ 9 9 9 14 13 9 9 9 9 9 14 21 31 32 32 34 25 25 25 25 26 19 19 20 13 14 18 18 13 9 9 14 21 19 23 12 9 9 9 9
+ 9 9 9 9 9 9 9 9 9 9 9 15 30 29 29 29 29 29 29 29 28 19 20 13 11 12 9 9 9 9 9 9 14 18 18 13 9 9 9 9
+ 9 9 9 9 9 9 9 9 9 9 9 14 18 18 18 18 18 18 18 18 18 18 13 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9
+ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
+ ))
+)
}
void
-Tux::draw()
+Tux::draw(const Point& offset)
+{
+ Point pos = get_pos();
+ sprite->draw(pos.x + offset.x,
+ pos.y + offset.y);
+}
+
+
+Point
+Tux::get_pos()
{
float x = tile_pos.x * 32;
float y = tile_pos.y * 32;
case NONE:
break;
}
-
- sprite->draw((int)x, (int)y);
+
+ return Point((int)x, (int)y);
}
void
}
void
-WorldMap::draw()
+WorldMap::draw(const Point& offset)
{
for(int y = 0; y < height; ++y)
for(int x = 0; x < width; ++x)
{
Tile* tile = at(Point(x, y));
- tile->sprite->draw(x*32, y*32);
+ tile->sprite->draw(x*32 + offset.x,
+ y*32 + offset.y);
}
for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
{
- leveldot_green->draw(i->x*32, i->y*32);
+ leveldot_green->draw(i->x*32 + offset.x,
+ i->y*32 + offset.y);
}
- tux->draw();
+ tux->draw(offset);
}
void
play_music(song, 1);
while(!quit) {
- draw();
+ Point tux_pos = tux->get_pos();
+ if (1)
+ {
+ offset.x = -tux_pos.x + screen->w/2;
+ offset.y = -tux_pos.y + screen->h/2;
+
+ if (offset.x > 0) offset.x = 0;
+ if (offset.y > 0) offset.y = 0;
+
+ if (offset.x < screen->w - width*32) offset.x = screen->w - width*32;
+ if (offset.y < screen->h - height*32) offset.y = screen->h - height*32;
+ }
+
+ draw(offset);
get_input();
update();