Transition cutscene for going outside.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 3 years ago
parent 35e9c3d3ee
commit 9fb2646864
  1. 35
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. 2
      assets/maps/map1

@ -19,6 +19,7 @@ enum CUTSCENE{
PAN_DOME, PAN_DOME,
PAUSE_TO_CUTSCENE_3, PAUSE_TO_CUTSCENE_3,
CUTSCENE_4, CUTSCENE_4,
TRANSITION_CUTSCENE,
}; };
enum WEATHER_POWER{ enum WEATHER_POWER{
@ -34,7 +35,7 @@ enum WEATHER_POWER{
#define ALPHA_SCREEN1 128 #define ALPHA_SCREEN1 128
#define ALPHA_SCREEN2 20 #define ALPHA_SCREEN2 20
#define FADE_SPD 6 #define FADE_SPD 6
#define MOVE_SPD 0.2 #define MOVE_SPD 0.075
#define MESSAGE_SCROLL_WAIT_SPD 2 //Number of frames to wait. #define MESSAGE_SCROLL_WAIT_SPD 2 //Number of frames to wait.
#define BATTLE_CAMERA_SCROLL_SPD 0.05 //How fast to scroll over to the battle. #define BATTLE_CAMERA_SCROLL_SPD 0.05 //How fast to scroll over to the battle.
@ -113,6 +114,8 @@ public:
sAppName = "Seasons of Loneliness"; sAppName = "Seasons of Loneliness";
} }
#define STARTING_MAP "assets/maps/map2"
public: public:
GAMESTATE GAME_STATE=GAMEWORLD; GAMESTATE GAME_STATE=GAMEWORLD;
int textInd=0; int textInd=0;
@ -123,12 +126,13 @@ public:
int frameCount=0; int frameCount=0;
float elapsedTime=0; float elapsedTime=0;
const float TARGET_RATE = 1/60.0; const float TARGET_RATE = 1/60.0;
std::string MAP_NAME = "";
std::string CUTSCENE_CONSOLE_TEXT = ""; std::string CUTSCENE_CONSOLE_TEXT = "";
int**MAP=NULL; int**MAP=NULL;
int MAP_WIDTH=-1; int MAP_WIDTH=-1;
int MAP_HEIGHT=-1; int MAP_HEIGHT=-1;
olc::Decal*TILES; olc::Decal*TILES;
float PLAYER_COORDS[2] = {21,35}; float PLAYER_COORDS[2] = {14,4};
std::vector<Object> OBJECTS; std::vector<Object> OBJECTS;
bool CUTSCENE_ACTIVE=false; bool CUTSCENE_ACTIVE=false;
CUTSCENE CURRENT_CUTSCENE=NONE; CUTSCENE CURRENT_CUTSCENE=NONE;
@ -294,7 +298,7 @@ public:
BASE_OBJECTS["METEORSHOWER_NODE"]=new ObjectLoadInfo(POWER_METEOR_SHOWER_DECAL,&POWER_METEOR_SHOWER_ANIMATION); BASE_OBJECTS["METEORSHOWER_NODE"]=new ObjectLoadInfo(POWER_METEOR_SHOWER_DECAL,&POWER_METEOR_SHOWER_ANIMATION);
BASE_OBJECTS["METEORSTORM_NODE"]=new ObjectLoadInfo(POWER_METEOR_STORM_DECAL,&POWER_METEOR_STORM_ANIMATION); BASE_OBJECTS["METEORSTORM_NODE"]=new ObjectLoadInfo(POWER_METEOR_STORM_DECAL,&POWER_METEOR_STORM_ANIMATION);
BASE_OBJECTS["SNOWSTORM_NODE"]=new ObjectLoadInfo(POWER_SNOWSTORM_DECAL,&POWER_SNOWSTORM_ANIMATION); BASE_OBJECTS["SNOWSTORM_NODE"]=new ObjectLoadInfo(POWER_SNOWSTORM_DECAL,&POWER_SNOWSTORM_ANIMATION);
LoadMap("assets/maps/map1"); LoadMap(STARTING_MAP);
return true; return true;
} }
@ -393,6 +397,15 @@ public:
GAME_STATE=GAMEWORLD; GAME_STATE=GAMEWORLD;
}break; }break;
} }
switch (CURRENT_CUTSCENE) {
case TRANSITION_CUTSCENE:{
LoadMap("assets/maps/map1");
PLAYER_COORDS[0]=40;
PLAYER_COORDS[1]=37;
fadeIn();
EndCutscene();
}break;
}
} }
void fadeInCompleted() { void fadeInCompleted() {
@ -404,7 +417,7 @@ public:
switch (scene) { switch (scene) {
case PAN_DOME:{ case PAN_DOME:{
PLAYER_COORDS[0]=14; PLAYER_COORDS[0]=14;
PLAYER_COORDS[1]=18+(64/2/32); PLAYER_COORDS[1]=35+(64/2/32);
}break; }break;
case PAUSE_TO_CUTSCENE_3:{ case PAUSE_TO_CUTSCENE_3:{
CUTSCENE_CONSOLE_TEXT.clear(); CUTSCENE_CONSOLE_TEXT.clear();
@ -527,9 +540,13 @@ public:
cout<<"Increased SNOWSTORM power inventory count by "<<amountGained<<".\n"; cout<<"Increased SNOWSTORM power inventory count by "<<amountGained<<".\n";
OBJECTS.erase(OBJECTS.begin()+i--); OBJECTS.erase(OBJECTS.begin()+i--);
} }
if (obj.name.compare("EXIT")==0&&collidesWithPlayer(obj)) {
fadeOut();
PlayCutscene(TRANSITION_CUTSCENE);
}
} }
if (!IN_BATTLE_ENCOUNTER) { if (!IN_BATTLE_ENCOUNTER&&MAP_NAME.compare("assets/maps/map1")==0) {
for (int i=0;i<ENCOUNTERS.size();i++) { for (int i=0;i<ENCOUNTERS.size();i++) {
Encounter enc = ENCOUNTERS.at(i); Encounter enc = ENCOUNTERS.at(i);
if (collidesWithPlayer(enc)) { if (collidesWithPlayer(enc)) {
@ -558,7 +575,7 @@ public:
} }
} }
} }
if (PLAYER_COORDS[0]!=TARGET_COORDS_Y) { if (PLAYER_COORDS[1]!=TARGET_COORDS_Y) {
if (PLAYER_COORDS[1]<TARGET_COORDS_Y) { if (PLAYER_COORDS[1]<TARGET_COORDS_Y) {
PLAYER_COORDS[1]+=BATTLE_CAMERA_SCROLL_SPD; PLAYER_COORDS[1]+=BATTLE_CAMERA_SCROLL_SPD;
if (PLAYER_COORDS[1]>TARGET_COORDS_Y) { if (PLAYER_COORDS[1]>TARGET_COORDS_Y) {
@ -849,6 +866,7 @@ public:
void LoadMap(char*mapName) { void LoadMap(char*mapName) {
std::ifstream f(mapName); std::ifstream f(mapName);
std::string data; std::string data;
MAP_NAME=mapName;
MAP_WIDTH=MAP_HEIGHT=-1; MAP_WIDTH=MAP_HEIGHT=-1;
if (MAP!=NULL) { if (MAP!=NULL) {
for (int y=0;y<MAP_HEIGHT;y++) { for (int y=0;y<MAP_HEIGHT;y++) {
@ -920,11 +938,16 @@ public:
if (obj.hasAnim) { if (obj.hasAnim) {
return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+obj.anim->width/32.0&& return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+obj.anim->width/32.0&&
PLAYER_COORDS[1]>=obj.y&&PLAYER_COORDS[1]<=obj.y+obj.anim->height/32.0; PLAYER_COORDS[1]>=obj.y&&PLAYER_COORDS[1]<=obj.y+obj.anim->height/32.0;
} else {
if (obj.spr==NULL) {
return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+1&&
PLAYER_COORDS[1]>=obj.y&&PLAYER_COORDS[1]<=obj.y+1;
} else { } else {
return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+obj.spr->sprite->width/32.0&& return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+obj.spr->sprite->width/32.0&&
PLAYER_COORDS[1]>=obj.y&&PLAYER_COORDS[1]<=obj.y+obj.spr->sprite->height/32.0; PLAYER_COORDS[1]>=obj.y&&PLAYER_COORDS[1]<=obj.y+obj.spr->sprite->height/32.0;
} }
} }
}
bool collidesWithPlayer(Encounter obj) { bool collidesWithPlayer(Encounter obj) {
return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+WIDTH/32&& return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+WIDTH/32&&

Binary file not shown.

@ -78,7 +78,7 @@
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
38;18;DOME 38;35;DOME
83;53;HAILSTORM_NODE 83;53;HAILSTORM_NODE
135;14;HAILSTORM_NODE 135;14;HAILSTORM_NODE
14;69;METEORSHOWER_NODE 14;69;METEORSHOWER_NODE

Loading…
Cancel
Save