You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SeasonI/trigger.h

62 lines
1.4 KiB

#ifndef TRIGGER_H
#define TRIGGER_H
#include "pixelGameEngine.h"
#include "flags.h"
#include "SeasonI.h"
using namespace olc;
namespace TriggerName{
//When adding new triggers to the list, you will have to add a new line to trigger.cpp to get it to appear in the editor.
enum Trigger{
NONE,
START_CUTSCENE_1
};
}
extern void DisplayMessageBox(std::string targetT);
extern SeasonI*GAME;
class Trigger{
vi2d pos;
vi2d size;
TriggerName::Trigger id;
public:
Trigger(vi2d pos,vi2d size,TriggerName::Trigger id)
:pos(pos),size(size),id(id){}
bool IsInside(vd2d point) {
return point.x>pos.x&&point.x<pos.x+size.x&&point.y>pos.y&&point.y<pos.y+size.y;
}
void Interact() {
switch (id) {
case TriggerName::START_CUTSCENE_1:{
if (!GAME->GetGameFlag(Flag::TEST_FLAG1)) {
DisplayMessageBox("You have triggered this scene.");
GAME->SetGameFlag(Flag::TEST_FLAG1,true);
}
}break;
}
}
vi2d GetPos() {
return pos;
}
vi2d GetSize() {
return size;
}
int GetPosX() {
return pos.x;
}
int GetPosY() {
return pos.y;
}
int GetSizeX() {
return size.x;
}
int GetSizeY() {
return size.y;
}
int GetID() {
return id;
}
};
#endif