Have a player state setup

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent a450f960e3
commit 2095d32d8f
  1. BIN
      A.A.png
  2. 32
      SeasonsOfLoneliness.cpp
  3. BIN
      Y.Y.png
  4. 9
      data.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -406,6 +406,14 @@ namespace effect {
}; };
}; };
class PlayerState{
public:
int playerHP,playerMaxHP;
int foodCount;
std::vector<int> weatherPowerCounts;
float x,y;
};
class SeasonsOfLoneliness : public PixelGameEngine class SeasonsOfLoneliness : public PixelGameEngine
{ {
public: public:
@ -616,6 +624,8 @@ public:
float audioLevel=0.6; float audioLevel=0.6;
int SEED_COUNT=0; int SEED_COUNT=0;
vf2d BATTLE_PLAYER_COORDS; vf2d BATTLE_PLAYER_COORDS;
PlayerState*PREV_PLAYERSTATE=new PlayerState();
int WALK_STEPS=0;
Map*CURRENT_MAP=MAP_1; Map*CURRENT_MAP=MAP_1;
@ -924,6 +934,10 @@ public:
BASE_OBJECTS["NADO"]=new ObjectLoadInfo(NADO_DECAL,NADO_ANIMATION,Pixel(153, 137, 75,230)); BASE_OBJECTS["NADO"]=new ObjectLoadInfo(NADO_DECAL,NADO_ANIMATION,Pixel(153, 137, 75,230));
BASE_OBJECTS["SILICON_PIECE"]=new ObjectLoadInfo(SILICON_ROCK_DECAL); BASE_OBJECTS["SILICON_PIECE"]=new ObjectLoadInfo(SILICON_ROCK_DECAL);
for (int i=0;i<WEATHER_POWER_COUNT;i++) {
PREV_PLAYERSTATE->weatherPowerCounts.push_back(WEATHER_POWERS[i]->playerOwnCount);
}
Zone*SILICON_DEPOSIT_ZONE = new Zone({109,7},{26,9},{0,0},{WIDTH,HEIGHT},{0,0},{WIDTH,HEIGHT},{1,1},{3,3},{-30,-3},{30,3},Pixel(133, 98, 66,180),Pixel(220, 120, 90,230),300,Pixel(87, 78, 69,64)); Zone*SILICON_DEPOSIT_ZONE = new Zone({109,7},{26,9},{0,0},{WIDTH,HEIGHT},{0,0},{WIDTH,HEIGHT},{1,1},{3,3},{-30,-3},{30,3},Pixel(133, 98, 66,180),Pixel(220, 120, 90,230),300,Pixel(87, 78, 69,64));
ZONES.push_back(SILICON_DEPOSIT_ZONE); ZONES.push_back(SILICON_DEPOSIT_ZONE);
@ -1226,12 +1240,14 @@ public:
LoadMap(MAP_3); LoadMap(MAP_3);
PLAYER_COORDS[0]=40.5; PLAYER_COORDS[0]=40.5;
PLAYER_COORDS[1]=37.5; PLAYER_COORDS[1]=37.5;
updatePlayerState();
fadeIn(); fadeIn();
EndCutscene(); EndCutscene();
} else { } else {
LoadMap(MAP_1); LoadMap(MAP_1);
PLAYER_COORDS[0]=40.5; PLAYER_COORDS[0]=40.5;
PLAYER_COORDS[1]=37.5; PLAYER_COORDS[1]=37.5;
updatePlayerState();
fadeIn(); fadeIn();
EndCutscene(); EndCutscene();
} }
@ -1253,6 +1269,7 @@ public:
} }
LoadMap(MAP_2); LoadMap(MAP_2);
TeleportToMapFileCoords(8,17); TeleportToMapFileCoords(8,17);
updatePlayerState();
fadeIn(); fadeIn();
EndCutscene(); EndCutscene();
if (GAME_FLAGS[gameflag::REST_IN_DOME]&&!GAME_FLAGS[gameflag::SLEEP]) { if (GAME_FLAGS[gameflag::REST_IN_DOME]&&!GAME_FLAGS[gameflag::SLEEP]) {
@ -1331,6 +1348,7 @@ public:
LoadMap(MAP_2); LoadMap(MAP_2);
PLAYER_COORDS[0]=16; PLAYER_COORDS[0]=16;
PLAYER_COORDS[1]=6; PLAYER_COORDS[1]=6;
updatePlayerState();
}break; }break;
case cutscene::RAINING_IN_DOME:{ case cutscene::RAINING_IN_DOME:{
applyPixelEffect(HURRICANE,GetMapFileCoords(7,11),1); applyPixelEffect(HURRICANE,GetMapFileCoords(7,11),1);
@ -2388,8 +2406,9 @@ public:
StartCutscene(cutscene::CHECK_COORDS); StartCutscene(cutscene::CHECK_COORDS);
CUTSCENE_OBJS[0]=CreateObject({PLAYER_COORDS[0],PLAYER_COORDS[1]},PLAYER_DECAL,playerAnim,true); CUTSCENE_OBJS[0]=CreateObject({PLAYER_COORDS[0],PLAYER_COORDS[1]},PLAYER_DECAL,playerAnim,true);
} }
if(rand()%60==0) { if(WALK_STEPS++>60&&!IN_BATTLE_ENCOUNTER) {
PLAYER_HP=std::clamp(PLAYER_HP+1,0,PLAYER_MAXHP); PLAYER_HP=std::clamp(PLAYER_HP+1,0,PLAYER_MAXHP);
updatePlayerState();
} }
} }
@ -3327,6 +3346,17 @@ public:
BATTLE_DISPLAY_NUMBERS.push_back(number); BATTLE_DISPLAY_NUMBERS.push_back(number);
return number; return number;
} }
void updatePlayerState() {
PREV_PLAYERSTATE->x=PLAYER_COORDS[0];
PREV_PLAYERSTATE->y=PLAYER_COORDS[1];
PREV_PLAYERSTATE->foodCount=foodCount;
PREV_PLAYERSTATE->playerHP=PLAYER_HP;
PREV_PLAYERSTATE->playerMaxHP=PLAYER_MAXHP;
for (int i=0;i<WEATHER_POWER_COUNT;i++) {
PREV_PLAYERSTATE->weatherPowerCounts[i]=WEATHER_POWERS[i]->playerOwnCount;
}
}
}; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -121,6 +121,15 @@ Well that was simpl-... Eh?)",//29
R"( R"(
$PLAYER $PLAYER
Worms? Don't think they're here to play either.)",//30 Worms? Don't think they're here to play either.)",//30
R"(
$PLAYER
Alright! Another one done. Oh! It's responding!)",//31
R"(
R.O.V.E.R. 2001
SIGNS INDICATE TRACES OF SILICON LOCATION ::: NORTHEAST)",//32
R"(
$PLAYER
Hopefully no more ambushes... (Or maybe I'll just jinx myself.))",//33
}; };

Loading…
Cancel
Save