fixed background drawing problems introduced with my last commit
[supertux.git] / src / trigger / door.cpp
index 79bfef8..4c338a5 100644 (file)
@@ -42,10 +42,12 @@ Door::Door(LispReader& reader)
   sprite = sprite_manager->create("door");
 }
 
-Door::Door(int x, int y)
+Door::Door(int x, int y, std::string sector, std::string spawnpoint)
 {
   bbox.set_pos(Vector(x, y));
   bbox.set_size(32, 64);
+  target_sector = sector;
+  target_spawnpoint = spawnpoint;
 
   sprite = sprite_manager->create("door");
 }
@@ -75,7 +77,7 @@ void
 Door::action(float )
 {
   //Check if door animation is complete
-  if (!sprite->check_animation()) {
+  if(sprite->check_animation()) {
     GameSession::current()->respawn(target_sector, target_spawnpoint);
   }
 }
@@ -87,11 +89,10 @@ Door::draw(DrawingContext& context)
 }
 
 void
-Door::event(Player& player, EventType type)
+Door::event(Player& , EventType type)
 {
   if(type == EVENT_ACTIVATE) {
-    sprite->set_action("open");
-    sprite->start_animation(1);
+    sprite->set_action("open", 1);
   }
 }