(action
(name "falling")
(x-offset 0)
- (y-offset )
+ (y-offset 0)
(images "creatures/kugelblitz/falling-0.png"
"creatures/kugelblitz/falling-1.png"
"creatures/kugelblitz/falling-2.png"))
"tiles/lava/lava1-4.png"
)
(water #t)
+ (spike #t)
(anim-fps 10)
)
(tile
"tiles/lava/lava2-4.png"
)
(water #t)
+ (spike #t)
(anim-fps 10)
)
(tile
)
(solid #t)
)
+ (tile
+ (id 1421)
+ (images
+ "tiles/water/electrified-0.png"
+ "tiles/water/electrified-1.png"
+ )
+ (anim-fps 5)
+ (spike #t)
+ (water #t)
+ )
+ (tile
+ (id 1422)
+ (images
+ "tiles/water/electrified_waves-0.png"
+ "tiles/water/electrified_waves-1.png"
+ )
+ (anim-fps 5)
+ (spike #t)
+ (water #t)
+ )
)
)
(poisonivy (x 800) (y 440))
(poisonivy (x 100) (y 438))
- (kugelblitz (x 519) (y 32))
+ (kugelblitz (x 219) (y 32))
(kugelblitz (x 700) (y 32))
(kugelblitz (x 1100) (y 169))
)
(name (_ "Dark Forest Keep - The Black Tower"))
(author "SuperTux Team")
(sector
- (name "main")
- (music "darkforestkeep.ogg")
+ (name "main")
+ (music "darkforestkeep.ogg")
(gravity 10.000000)
(tilemap
(layer "background")
HitResponse
Kugelblitz::collision_solid(GameObject& , const CollisionHit& chit)
{
- //TODO: Explode when Tux is hit
return hit(chit);
}
HitResponse
+Kugelblitz::collision_player(Player& player, const CollisionHit& )
+{
+ if(player.is_invincible()) {
+ explode();
+ return ABORT_MOVE;
+ }
+ // hit from above?
+ if(player.get_movement().y - get_movement().y > 0 && player.get_bbox().p2.y <
+ (get_bbox().p1.y + get_bbox().p2.y) / 2) {
+ // if it's not is it possible to squish us, then this will hurt
+ if(!collision_squished(player))
+ player.kill(Player::SHRINK);
+ explode();
+ return FORCE_MOVE;
+ }
+ player.kill(Player::SHRINK);
+ explode();
+ return FORCE_MOVE;
+}
+
+HitResponse
Kugelblitz::collision_badguy(BadGuy& other , const CollisionHit& chit)
{
//Let the Kugelblitz explode, too?
void
Kugelblitz::active_update(float elapsed_time)
{
- if (lifetime.check()) {
- if (!dying) {
- sprite->set_action("pop");
- lifetime.start(0.2);
- dying = true;
- }
- else remove_me();
+ if (electrify_timer.check()) {
+ Sector::current()->solids->change_all(1421,75);
+ Sector::current()->solids->change_all(1422,76);
+ explode();
+ }
+ else if (lifetime.check()) {
+ explode();
}
else {
if (groundhit_pos_set) {
}
if (Sector::current()->solids->get_tile_at(get_pos())->getAttributes() == 16) {
//HIT WATER
+ Sector::current()->solids->change_all(75,1421);
+ Sector::current()->solids->change_all(76,1422);
+ physic.set_velocity_x(0);
+ physic.set_velocity_y(0);
+ electrify_timer.start(1);
}
}
BadGuy::active_update(elapsed_time);
{
}
+void
+Kugelblitz::explode()
+{
+ if (!dying) {
+ sprite->set_action("pop");
+ lifetime.start(0.2);
+ dying = true;
+ }
+ else remove_me();
+}
+
IMPLEMENT_FACTORY(Kugelblitz, "kugelblitz")
Kugelblitz(const lisp::Lisp& reader);
void activate();
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_player(Player& player, const CollisionHit& hit);
void write(lisp::Writer& writer);
void active_update(float);
void kill_fall();
+ void explode();
private:
HitResponse hit(const CollisionHit& hit);
bool dying;
Timer movement_timer;
Timer lifetime;
+ Timer electrify_timer;
int direction;
};
change(int(pos.x)/32, int(pos.y)/32, newtile);
}
+void
+TileMap::change_all(uint32_t oldtile, uint32_t newtile)
+{
+ for (size_t x = 0; x < get_width(); x++)
+ for (size_t y = 0; y < get_height(); y++) {
+ if (get_tile(x,y)->getID() == oldtile) change(x,y,newtile);
+ }
+}
+
IMPLEMENT_FACTORY(TileMap, "tilemap");
void change_at(const Vector& pos, uint32_t newtile);
+ /// changes all tiles with the given ID
+ void change_all(uint32_t oldtile, uint32_t newtile);
+
TileManager* get_tilemanager() const
{
return tilemanager;
#include "object/bullet.hpp"
#include "object/text_object.hpp"
#include "badguy/jumpy.hpp"
-#include "badguy/spike.hpp"
#include "trigger/sequence_trigger.hpp"
#include "player_status.hpp"
#include "scripting/script_interpreter.hpp"