Zone effects

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 29ab43fbb2
commit 95d0f85cff
  1. 77
      SeasonsOfLoneliness.cpp
  2. BIN
      assets/brokenROVER.png
  3. 57
      assets/maps/map1
  4. 3
      data.h

@ -55,6 +55,7 @@ namespace cutscene{
WALK_TO_COMPUTER,
INPUT_USERNAME,
GO_OUTSIDE,
WALK_TO_ROVER
};
}
@ -264,6 +265,18 @@ class Encounter{
std::vector<int> turnOrder;
};
class Zone{
public:
vi2d pos; //In tile coordinates.
vi2d size; //In tile coordinates.
ParticleEffect*eff;
Zone(vi2d pos,vi2d size,vf2d effectPos,vf2d effectSize,vf2d pos_low,vf2d pos_high,vf2d size_low,vf2d size_high,vf2d spd_low,vf2d spd_high,olc::Pixel col_low,olc::Pixel col_high,int amt,olc::Pixel foregroundColor) {
this->pos=pos;
this->size=size;
this->eff=new ParticleEffect(effectPos,effectSize,pos_low,pos_high,size_low,size_high,spd_low,spd_high,col_low,col_high,amt,foregroundColor);
}
};
namespace effect {
class Pixel{
public:
@ -410,13 +423,14 @@ public:
int TERMINAL_SELECTED_CHAR=0;
std::string TERMINAL_INPUT="";
std::string PLAYER_NAME="...";
std::vector<Zone*>ZONES;
Decal*DOME_DECAL,*FOOD_METER_DECAL,*OXYGEN_METER_DECAL,*PLANT_DECAL,
*PLAYER_DECAL,
*WEATHERNODE_EFFECT_DECAL,*POWER_HAILSTORM_DECAL,*POWER_HURRICANE_DECAL,*POWER_METEOR_SHOWER_DECAL,*POWER_METEOR_STORM_DECAL,*POWER_SNOWSTORM_DECAL,
*SPIDEY_DECAL,*TARGETING_CIRCLE,*TARGETING_RANGE_CIRCLE,*HEALTHBAR_DECAL,
*CONSUME_SNACK_DECAL,*CONSUME_MEAL_DECAL,*COMPUTER_DECAL;
*CONSUME_SNACK_DECAL,*CONSUME_MEAL_DECAL,*COMPUTER_DECAL,*BROKEN_ROVER_DECAL;
std::map<std::string,ObjectLoadInfo*> BASE_OBJECTS;
std::vector<Encounter> ENCOUNTERS;
Encounter ENCOUNTER_SPIDEY_1;
@ -458,6 +472,7 @@ public:
TARGETING_RANGE_CIRCLE=new Decal(new Sprite("assets/targetRange.png"));
HEALTHBAR_DECAL=new Decal(new Sprite("assets/healthbar.png"));
COMPUTER_DECAL=new Decal(new Sprite("assets/computerSystem.png"));
BROKEN_ROVER_DECAL=new Decal(new Sprite("assets/brokenROVER.png"));
current_playerAnim.spr=PLAYER_DECAL;
playerAnim.spr=PLAYER_DECAL;
@ -559,6 +574,11 @@ public:
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["COMPUTER"]=new ObjectLoadInfo(COMPUTER_DECAL);
BASE_OBJECTS["BROKEN_ROVER"]=new ObjectLoadInfo(BROKEN_ROVER_DECAL);
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);
for (int i=0;i<MAX_PIXELS;i++) {
@ -825,7 +845,7 @@ public:
PLAYER_COORDS[1]=6;
}break;
case cutscene::RAINING_IN_DOME:{
applyPixelEffect(HURRICANE,GetMapFileCoords(7,11));
applyPixelEffect(HURRICANE,GetMapFileCoords(7,11),1);
CUTSCENE_TIMER=0;
}break;
}
@ -922,9 +942,20 @@ public:
if (positionModified) {
playerMoved();
}
}
if (playerCanMove()) {
bool zoneEffectActive=false;
for (int i=0;i<ZONES.size();i++) {
Zone*z = ZONES[i];
if (PLAYER_COORDS[0]>=z->pos.x&&PLAYER_COORDS[0]<=z->pos.x+z->size.x&&
PLAYER_COORDS[1]>=z->pos.y&&PLAYER_COORDS[1]<=z->pos.y+z->size.y) {
if (PIXEL_EFFECT_TRANSPARENCY==0) {
applyPixelEffect(z->eff,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0.9);
}
zoneEffectActive=true;
}
}
if (!zoneEffectActive&&PIXEL_EFFECT_TRANSPARENCY>0) {
clearPixelEffect();
}
for (int i=0;i<OBJECTS.size();i++) {
Object*obj = OBJECTS[i];
if (obj->name.compare("HAILSTORM_NODE")==0&&collidesWithPlayer(obj)) {
@ -1030,6 +1061,7 @@ public:
int TARGET_COORDS_Y=CURRENT_ENCOUNTER.y+HEIGHT/32/2;
if (PLAYER_COORDS[0]==TARGET_COORDS_X&&PLAYER_COORDS[1]==TARGET_COORDS_Y) {
BATTLE_STATE = battle::PLAYER_SELECTION;
clearPixelEffect();
EFFECT_TIMER = 0;
} else
if (PLAYER_COORDS[0]!=TARGET_COORDS_X) {
@ -1065,15 +1097,15 @@ public:
PIXEL_EFFECT_TRANSPARENCY=0;
if (BATTLE_CURRENT_TURN_ENTITY==-1) {
if (PLAYER_SELECTED_TARGET==-2) {
applyPixelEffect(BATTLE_CARD_SELECTION,{PLAYER_COORDS[0],PLAYER_COORDS[1]});
applyPixelEffect(BATTLE_CARD_SELECTION,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0);
} else {
applyPixelEffect(BATTLE_CARD_SELECTION,{CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y});
applyPixelEffect(BATTLE_CARD_SELECTION,{CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y},0);
}
} else {
if (CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove->damage<0) {
applyPixelEffect(CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove,{CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y});
applyPixelEffect(CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove,{CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y},0);
} else {
applyPixelEffect(CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove,{PLAYER_COORDS[0],PLAYER_COORDS[1]});
applyPixelEffect(CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0);
}
}
}
@ -2008,7 +2040,27 @@ public:
CUTSCENE_DISPLAYED_CARD=POWER;
}
void applyPixelEffect(WEATHER_POWER*power,vf2d pos) {
void applyPixelEffect(ParticleEffect*effect,vf2d pos,float startingTransparency) {
SetDrawTarget(nullptr);
Clear(BLANK);
SetDrawTarget(1);
applyPixelEffect(
{(pos.x-PLAYER_COORDS[0])*32+WIDTH/2-16-effect->effectSize.x/2,(pos.y-PLAYER_COORDS[1])*32+HEIGHT/2-16-effect->effectSize.y/2},
effect->effectSize,
effect->pos_low,
effect->pos_high,
effect->size_low,
effect->size_high,
effect->spd_low,
effect->spd_high,
effect->col_low,
effect->col_high,
effect->amt,
effect->foregroundColor,startingTransparency
);
}
void applyPixelEffect(WEATHER_POWER*power,vf2d pos,float startingTransparency) {
SetDrawTarget(nullptr);
Clear(BLANK);
SetDrawTarget(1);
@ -2024,11 +2076,11 @@ public:
power->effect->col_low,
power->effect->col_high,
power->effect->amt,
power->effect->foregroundColor
power->effect->foregroundColor,startingTransparency
);
}
void applyPixelEffect(vf2d effectPos,vf2d effectSize,vf2d pos_low,vf2d pos_high,vf2d size_low,vf2d size_high,vf2d spd_low,vf2d spd_high,olc::Pixel col_low,olc::Pixel col_high,int amt,olc::Pixel foregroundColor) {
void applyPixelEffect(vf2d effectPos,vf2d effectSize,vf2d pos_low,vf2d pos_high,vf2d size_low,vf2d size_high,vf2d spd_low,vf2d spd_high,olc::Pixel col_low,olc::Pixel col_high,int amt,olc::Pixel foregroundColor,float startingTransparency) {
for (int i=0;i<amt;i++) {
pixels[i]->pos={range(pos_low.x,pos_high.x),range(pos_low.y,pos_high.y)};
pixels[i]->size={range(size_low.x,size_high.x),range(size_low.y,size_high.y)};
@ -2044,6 +2096,7 @@ public:
PIXEL_POS=effectPos;
PIXEL_SIZE=effectSize;
PIXEL_LIMIT=amt;
PIXEL_EFFECT_TRANSPARENCY=startingTransparency;
}
void clearPixelEffect() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

@ -2,34 +2,34 @@
78
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000005000550000500000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000005000550000000000000050000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500005055000050000550005050000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005500550000050000500050050000550005000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000055555555555555555555555555000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000055555555555555555555555555550000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000000555555555555555555555500000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000505000555555555555555555555505055000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055000500005555555555555555555000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050000500555555555555550000050000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000555555550000500500000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000505505000000555555550055000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000555555550500550000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050500000000500005050000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055000000000000500050000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050000500500000550000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000550000000000000005500000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000550000000000005550000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000550000000000000000000000005500000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005500000000000000000050000055500000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055500000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@ -85,3 +85,4 @@
202;33;METEORSTORM_NODE
167;44;SNOWSTORM_NODE
20;10;HURRICANE_NODE
33;35;BROKEN_ROVER

@ -55,6 +55,9 @@ What a great harvest!)",//11
R"(
CompU-16770
Authenticated. Record successfully logged.)",//12
R"(
R.O.V.E.R. 2001
< No response... >)",//13
};

Loading…
Cancel
Save