Encounter battle moveover

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 9fb2646864
commit f8c2e5b061
  1. 12
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness

@ -195,7 +195,7 @@ public:
std::map<std::string,ObjectLoadInfo*> BASE_OBJECTS; std::map<std::string,ObjectLoadInfo*> BASE_OBJECTS;
std::vector<Encounter> ENCOUNTERS; std::vector<Encounter> ENCOUNTERS;
Encounter ENCOUNTER_SPIDEY_1; Encounter ENCOUNTER_SPIDEY_1;
Encounter*CURRENT_ENCOUNTER; Encounter CURRENT_ENCOUNTER;
bool OnUserCreate() override bool OnUserCreate() override
{ {
@ -509,7 +509,7 @@ public:
} }
for (int i=0;i<OBJECTS.size();i++) { for (int i=0;i<OBJECTS.size();i++) {
Object obj = OBJECTS.at(i); Object obj = OBJECTS[i];
if (obj.name.compare("HAILSTORM_NODE")==0&&collidesWithPlayer(obj)) { if (obj.name.compare("HAILSTORM_NODE")==0&&collidesWithPlayer(obj)) {
int amountGained=rand()%4+2; int amountGained=rand()%4+2;
WEATHER_POWERS[HAILSTORM]+=amountGained; WEATHER_POWERS[HAILSTORM]+=amountGained;
@ -548,10 +548,10 @@ public:
if (!IN_BATTLE_ENCOUNTER&&MAP_NAME.compare("assets/maps/map1")==0) { 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[i];
if (collidesWithPlayer(enc)) { if (collidesWithPlayer(enc)) {
IN_BATTLE_ENCOUNTER=true; IN_BATTLE_ENCOUNTER=true;
CURRENT_ENCOUNTER=&enc; CURRENT_ENCOUNTER=enc;
BATTLE_ENTRY_TIMER=0; BATTLE_ENTRY_TIMER=0;
} }
} }
@ -560,8 +560,8 @@ public:
if (IN_BATTLE_ENCOUNTER) { if (IN_BATTLE_ENCOUNTER) {
BATTLE_ENTRY_TIMER++; BATTLE_ENTRY_TIMER++;
if (BATTLE_ENTRY_TIMER>45) { if (BATTLE_ENTRY_TIMER>45) {
int TARGET_COORDS_X=CURRENT_ENCOUNTER->x+WIDTH/32/2; int TARGET_COORDS_X=CURRENT_ENCOUNTER.x+WIDTH/32/2;
int TARGET_COORDS_Y=CURRENT_ENCOUNTER->y+HEIGHT/32/2; int TARGET_COORDS_Y=CURRENT_ENCOUNTER.y+HEIGHT/32/2;
if (PLAYER_COORDS[0]!=TARGET_COORDS_X) { if (PLAYER_COORDS[0]!=TARGET_COORDS_X) {
if (PLAYER_COORDS[0]<TARGET_COORDS_X) { if (PLAYER_COORDS[0]<TARGET_COORDS_X) {
PLAYER_COORDS[0]+=BATTLE_CAMERA_SCROLL_SPD; PLAYER_COORDS[0]+=BATTLE_CAMERA_SCROLL_SPD;

Binary file not shown.
Loading…
Cancel
Save