--- /dev/null
+(supertux-level\r
+ (version 2)\r
+ (name (_ "Door Test"))\r
+ (author "Mathnerd314")\r
+ (sector\r
+ (name "main")\r
+ (music "music/chipdisko.ogg")\r
+ (ambient-light 1 1 1)\r
+ (background\r
+ (speed 0.5)\r
+ (image "images/background/arctis.jpg")\r
+ )\r
+ (camera\r
+ (mode "normal")\r
+ )\r
+ (door\r
+ (x 288)\r
+ (y 448)\r
+ (script "ghost()")\r
+ )\r
+ (door\r
+ (x 384)\r
+ (y 448)\r
+ (sector "main")\r
+ (spawnpoint "test")\r
+ )\r
+ (spawnpoint\r
+ (name "main")\r
+ (x 100)\r
+ (y 100)\r
+ )\r
+ (spawnpoint\r
+ (name "test")\r
+ (x 500)\r
+ (y 100)\r
+ )\r
+ (tilemap\r
+ (solid #t)\r
+ (z-pos 0)\r
+ (width 27)\r
+ (height 19)\r
+ (tiles\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 0 0 0 0 0 0\r
+ 13 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 15 0 0 0 0 0 0\r
+ 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 0 0 0 0 0 0\r
+ )\r
+ )\r
+ )\r
+)\r
#include "sprite/sprite_manager.hpp"
#include "supertux/game_session.hpp"
#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
#include "trigger/door.hpp"
#include "util/reader.hpp"
reader.get("sector", target_sector);
reader.get("spawnpoint", target_spawnpoint);
+ reader.get("script", script);
+
sprite = sprite_manager->create("images/objects/door/door.sprite");
sprite->set_action("closed");
bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
if (player) {
state = CLOSING;
sprite->set_action("closing", 1);
- GameSession::current()->respawn(target_sector, target_spawnpoint);
+ if(script != "") {
+ std::istringstream stream(script);
+ Sector::current()->run_script(stream, "Door");
+ }
+
+ if(target_sector != "") {
+ GameSession::current()->respawn(target_sector, target_spawnpoint);
+ }
}
}
break;
DoorState state; /**< current state of the door */
std::string target_sector; /**< target sector to teleport to */
std::string target_spawnpoint; /**< target spawnpoint to teleport to */
+ std::string script;
SpritePtr sprite; /**< "door" sprite to render */
Timer stay_open_timer; /**< time until door will close again */
};