return;
}
+ // Kill us if we landed on spikes
+ if (dying == DYING_NOT
+ && (kind != BAD_STALACTITE && kind != BAD_FLAME && kind != BAD_BOMB)
+ && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y)
+ || isspike(base.x, base.y + base.height)
+ || isspike(base.x + base.width, base.y + base.height)))
+ {
+ physic.set_velocity_y(3);
+ kill_me(0);
+ }
+
// Once it's on screen, it's activated!
if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE)
seen = true;
physic.enable_gravity(true);
/* Gain some points: */
+ if (score != 0)
World::current()->add_score(base.x, base.y,
score * player_status.score_multiplier);
return tile && tile->ice;
}
+bool isspike(float x, float y)
+{
+ Tile* tile = gettile(x,y);
+ return tile && tile->spike;
+}
+
bool isfullbox(float x, float y)
{
Tile* tile = gettile(x,y);
bool issolid(float x, float y);
bool isbrick(float x, float y);
bool isice(float x, float y);
+bool isspike(float x, float y);
bool isfullbox(float x, float y);
typedef void* (*tiletestfunction)(Tile* tile);
void
Trampoline::action(double frame_ratio)
{
+ // TODO: Remove if we're too far off the screen
+
physic.apply(frame_ratio, base.x, base.y);
// Falling
collision_swept_object_map(&old_base, &base);
+ if (!invincible_timer.started()
+ && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y)
+ || isspike(base.x, base.y + base.height)
+ || isspike(base.x + base.width, base.y + base.height)))
+ {
+ kill(SHRINK);
+ }
+
// Don't accelerate Tux if he is running against a wall
if (target.x != base.x)
{
tile->brick = false;
tile->ice = false;
tile->water = false;
+ tile->spike = false;
tile->fullbox = false;
tile->distro = false;
tile->goal = false;
reader.read_bool("brick", &tile->brick);
reader.read_bool("ice", &tile->ice);
reader.read_bool("water", &tile->water);
+ reader.read_bool("spike", &tile->spike);
reader.read_bool("fullbox", &tile->fullbox);
reader.read_bool("distro", &tile->distro);
reader.read_bool("goal", &tile->goal);
/** water */
bool water;
+ /** spike - kills player on contact */
+ bool spike;
+
/** Bonusbox, content is stored in \a data */
bool fullbox;
/** Tile is a distro/coin */
bool distro;
+
/** the level should be finished when touching a goaltile.
* if data is 0 then the endsequence should be triggered, if data is 1
* then we can finish the level instantly.