(gravity 10.000000)
(background (image "arctis.jpg")
(speed 0.5))
- (secretarea (x 64) (y 896) (message "You found a secret area!"))
+ (secretarea (x 128) (y 128) (message "You found a secret area!"))
(spawn-points
(name "main")
(x 100)
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 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 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 0 0 0 0 0 0 0 0 0
- 0 200 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 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 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 0 0 0 0 0 0 0
))
(tilemap
61 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 0 61
61 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 0 61
61 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 0 61
- 61 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 0 61
+ 61 0 0 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 0 0 61
61 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 0 61
61 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 0 61
61 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 0 61
{
bbox.set_pos(pos);
bbox.set_size(32, 32);
- triggerevent = EVENT_TOUCH;
- show_message = 0;
+ message = "You found a secret area!";
}
SecretAreaTrigger::~SecretAreaTrigger()
void
SecretAreaTrigger::draw(DrawingContext& context)
{
- if (show_message == 1) {
- context.draw_center_text(gold_text, message, Vector(0, screen->h/2 - gold_text->get_height()/2), LAYER_GUI);
- std::cout<<message<<std::endl;
+ if (message_timer.started()) {
+ Vector pos = Vector(0, screen->h/2 - gold_text->get_height()/2);
+ context.draw_center_text(gold_text, message, pos, LAYER_GUI);
+ //TODO: Prevent text from scrolling with the rest of the level
+ }
+ if (message_timer.check()) {
+ remove_me();
}
}
void
SecretAreaTrigger::event(Player& , EventType type)
{
- if(type == triggerevent) {
- show_message = 1;
+ if(type == EVENT_TOUCH) {
+ message_timer.start(MESSAGE_TIME);
}
}
#include "resources.h"
#include "video/drawing_context.h"
#include "app/globals.h"
+#include "timer.h"
+
+#define MESSAGE_TIME 3
class SecretAreaTrigger : public TriggerBase, public Serializable
{
void draw(DrawingContext& context);
private:
- EventType triggerevent;
std::string message;
- int show_message;
+ Timer2 message_timer;
};
#endif