Enemy spoils drop

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 1bdf96a8ee
commit d5a5165230
  1. BIN
      C++ProjectTemplate
  2. BIN
      C++ProjectTemplate.data
  3. 2
      C++ProjectTemplate.js
  4. BIN
      C++ProjectTemplate.wasm
  5. 23
      effect.h
  6. 19
      item.h
  7. 110
      main.cpp
  8. 42
      particle.h
  9. 2
      states.h

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 839 KiB

After

Width:  |  Height:  |  Size: 840 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -38,5 +38,26 @@ class FountainEffect:public Effect{
}
};
FountainEffect*FOUNTAIN_EFFECT;
class FireFountainEffect:public Effect{
int fountainDensity=0;
int lifetime=0;
public:
FireFountainEffect(int fountainDensity,int lifetime)
:fountainDensity(fountainDensity),lifetime(lifetime){
this->maxLifeTime=lifetime;
}
void create(std::vector<Particle*>&PARTICLES){
lifetime=maxLifeTime;
for (int i=0;i<fountainDensity;i++) {
PARTICLES.push_back(new FireParticle({(double)(rand()%3+1),(double)(rand()%3+1)},{0,rand()%10/10.0F+0.1F},lifetime,Pixel(255,rand()%255,0)));
}
for (int i=0;i<60;i++) {
PARTICLES.push_back(new StaticLineParticle(maxLifeTime,Pixel(255,rand()%255,0,rand()%255)));
}
}
bool update()override{
lifetime--;
return lifetime>0;
}
};
#endif

@ -76,16 +76,17 @@ class Item{
std::string description;
Battle::Move*battlemove=nullptr;
ItemStatsStruct stats;
int dropChance=8; //1 out of dropChance change of item dropping.
std::vector<CustomItemMessage> messages;
Item(std::string name,std::string desc,ItemStatsStruct stats={hpRecovery:0,ppRecovery:0,atkIncrease:0,spdIncrease:0,hpIncrease:0,ppIncrease:0,learnAbility:nullptr,damage:0,rollDmg:0,attack:0,defense:0,equip:EquipSlot::NONE,important:false,consumable:Consumable::NOT_A_CONSUMABLE},Battle::Move*battlemove=nullptr)
:name(name),description(desc),stats(stats),battlemove(battlemove){
if (stats.hpRecovery) {messages.push_back({L"$USER recovers "+std::to_wstring(stats.hpRecovery)+L" HP.",ItemAction::HPRECOVERY});}
if (stats.ppRecovery) {messages.push_back({L"$USER recovers "+std::to_wstring(stats.ppRecovery)+L" PP.",ItemAction::PPRECOVERY});}
if (stats.atkIncrease) {messages.push_back({L"$USER gains "+std::to_wstring(stats.atkIncrease)+L" ATK point"+(stats.atkIncrease==1?L"":L"s")+L".",ItemAction::ATKINCREASE});}
if (stats.hpIncrease) {messages.push_back({L"$USER gains "+std::to_wstring(stats.hpIncrease)+L" HP point"+(stats.hpIncrease==1?L"":L"s")+L".",ItemAction::HPINCREASE});}
if (stats.ppIncrease) {messages.push_back({L"$USER gains "+std::to_wstring(stats.ppIncrease)+L" PP point"+(stats.ppIncrease==1?L"":L"s")+L".",ItemAction::PPINCREASE});}
if (stats.spdIncrease) {messages.push_back({L"$USER gains "+std::to_wstring(stats.spdIncrease)+L" SPD point"+(stats.spdIncrease==1?L"":L"s")+L".",ItemAction::SPDINCREASE});}
if (stats.learnAbility!=nullptr) {messages.push_back({L"$USER gains the ability to use "+transform_to<std::wstring>(stats.learnAbility->name)+L" "+((stats.learnAbility->grade!=0)?std::wstring(1,stats.learnAbility->grade):L"")+L"!",ItemAction::LEARNMOVE});}
Item(std::string name,std::string desc,int dropChance=8,ItemStatsStruct stats={hpRecovery:0,ppRecovery:0,atkIncrease:0,spdIncrease:0,hpIncrease:0,ppIncrease:0,learnAbility:nullptr,damage:0,rollDmg:0,attack:0,defense:0,equip:EquipSlot::NONE,important:false,consumable:Consumable::NOT_A_CONSUMABLE},Battle::Move*battlemove=nullptr)
:name(name),description(desc),stats(stats),dropChance(dropChance),battlemove(battlemove){
if (stats.hpRecovery) {messages.push_back({L"$TARGET recovers "+std::to_wstring(stats.hpRecovery)+L" HP.",ItemAction::HPRECOVERY});}
if (stats.ppRecovery) {messages.push_back({L"$TARGET recovers "+std::to_wstring(stats.ppRecovery)+L" PP.",ItemAction::PPRECOVERY});}
if (stats.atkIncrease) {messages.push_back({L"$TARGET gains "+std::to_wstring(stats.atkIncrease)+L" ATK point"+(stats.atkIncrease==1?L"":L"s")+L".",ItemAction::ATKINCREASE});}
if (stats.hpIncrease) {messages.push_back({L"$TARGET gains "+std::to_wstring(stats.hpIncrease)+L" HP point"+(stats.hpIncrease==1?L"":L"s")+L".",ItemAction::HPINCREASE});}
if (stats.ppIncrease) {messages.push_back({L"$TARGET gains "+std::to_wstring(stats.ppIncrease)+L" PP point"+(stats.ppIncrease==1?L"":L"s")+L".",ItemAction::PPINCREASE});}
if (stats.spdIncrease) {messages.push_back({L"$TARGET gains "+std::to_wstring(stats.spdIncrease)+L" SPD point"+(stats.spdIncrease==1?L"":L"s")+L".",ItemAction::SPDINCREASE});}
if (stats.learnAbility!=nullptr) {messages.push_back({L"$TARGET gains the ability to use "+transform_to<std::wstring>(stats.learnAbility->name)+L" "+((stats.learnAbility->grade!=0)?std::wstring(1,stats.learnAbility->grade):L"")+L"!",ItemAction::LEARNMOVE});}
}
};
#endif

@ -1,4 +1,5 @@
#include "item.h"
#include <string>
#define OLC_PGE_APPLICATION
#include "pixelGameEngine.h"
#define OLC_PGEX_SPLASHSCREEN
@ -144,6 +145,8 @@ public:
CustomItemMessage BATTLE_CURRENT_CUSTOM_MSG;
int BATTLE_CUSTOM_MESSAGE_WAIT_TIME=0;
Item*BATTLE_CUSTOM_ITEM;
std::vector<Item*> BATTLE_SPOILS_LIST;
std::wstring BATTLE_SPOILS_MESSAGE;
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
@ -162,6 +165,11 @@ public:
std::map<ItemName,Item*>ITEMLIST;
vi2d SELECTED_MOVE_SQUARE;
FountainEffect*FOUNTAIN_EFFECT;
FireFountainEffect*FIREFOUNTAIN_EFFECT;
Effect*CURRENT_EFFECT=nullptr;
bool OnUserCreate() override
@ -177,6 +185,7 @@ public:
// Called once at the start, so create things here
FOUNTAIN_EFFECT = new FountainEffect(250,200);
FIREFOUNTAIN_EFFECT = new FireFountainEffect(400,200);
EnableLayer(layer::COLLISION,false);
@ -392,7 +401,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
}
}
if (moved) {
vi2d cameraOffset={WIDTH/2,HEIGHT/2};
const vi2d cameraOffset={WIDTH/2,HEIGHT/2};
cameraPos=PARTY_MEMBER_OBJ[0]->GetPos()-cameraOffset;
}
if (moved&&BATTLE_ENCOUNTER==nullptr) {
@ -1362,7 +1371,14 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
DrawFancyStringDecal(text+shadowOffset,Wrap(label,ScreenWidth()-2,false,{1,2}),BLACK,{1,2});
DrawFancyStringDecal(text,Wrap(label,ScreenWidth()-2,false,{1,2}),WHITE,{1,2});
}
if (BATTLE_STATE!=BattleState::MOVE_CAMERA) {
if (BATTLE_STATE==BattleState::ENEMY_SPOILS) {
SetDrawTarget(layer::INTERFACE);
vd2d text={2,2};
vd2d shadowOffset={1,1};
DrawFancyStringDecal(text+shadowOffset,Wrap(BATTLE_SPOILS_MESSAGE,ScreenWidth()-2,false,{1,2}),BLACK,{1,2});
DrawFancyStringDecal(text,Wrap(BATTLE_SPOILS_MESSAGE,ScreenWidth()-2,false,{1,2}),WHITE,{1,2});
}
if (BATTLE_STATE!=BattleState::MOVE_CAMERA&&BATTLE_STATE!=BattleState::MOVE_CAMERA_BACK) {
SetDrawTarget(layer::INTERFACE);
vi2d screenShakeOffset = {0,0};
cameraPos = BATTLE_ENCOUNTER->pos;
@ -1468,7 +1484,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
DrawStringPropDecal({(int)(WIDTH*(3.0F/8))+4,HEIGHT/2+8},Wrap(PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->description,(int)(WIDTH*(5.0F/8))-4,true,{1,1}));
for (int i=0;i<18;i++) {
if (ITEM_SELECTION_OFFSET+i<PARTY_INVENTORY.size()) {
DrawStringDecal({static_cast<float>(16+i%2*(WIDTH-8)/2),static_cast<float>(12*(i/2)+8)},PARTY_INVENTORY[ITEM_SELECTION_OFFSET+i]->name);
DrawStringPropDecal({static_cast<float>(16+i%2*(WIDTH-8)/2),static_cast<float>(12*(i/2)+8)},PARTY_INVENTORY[ITEM_SELECTION_OFFSET+i]->name,WHITE,{std::clamp((float)(WIDTH-48)/2/GetTextSizeProp(PARTY_INVENTORY[ITEM_SELECTION_OFFSET+i]->name).x,0.0F,1.0F),1.0F});
}
}
if (ITEM_SELECTION_OFFSET>0) {
@ -1933,21 +1949,21 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MOVELIST[BattleMoveName::PKFIRE_A]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",ALPHA,60,20, 6,3,0,false,{0,0,20,0});
MOVELIST[BattleMoveName::PKFIRE_B]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",BETA,120,40, 12,4,0,false,{0,0,20,0});
MOVELIST[BattleMoveName::PKFIRE_G]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",GAMMA,190,50, 20,5,0,false,{0,0,20,0});
MOVELIST[BattleMoveName::PKFIRE_O]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",OMEGA,360,100, 32,7,0,false,{0,0,20,0});
MOVELIST[BattleMoveName::PKFIRE_O]=new Battle::Move("PK Fire","Causes extreme heat to burn foes and scorch trees",OMEGA,360,100, 32,7,0,false,{0,0,20,0},L"$USER uses $POWER",FIREFOUNTAIN_EFFECT);
}
void SetupItemList() { //hpRecovery,ppRecovery,attack,dmgReduction,equip,important,consumable
ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",{hpRecovery:40,consumable:Consumable::FRIENDLY});
ITEMLIST[ItemName::EGG]=new Item("Egg","Did it come before or after the chicken? Restores 60 HP.",{hpRecovery:60,consumable:Consumable::FRIENDLY});
ITEMLIST[ItemName::PIZZA]=new Item("Pizza","A scrumptious meal filled with lots of cheese. Restores 200 HP.",{hpRecovery:200,consumable:Consumable::FRIENDLY});
ITEMLIST[ItemName::MIRACLE_FOOD_LUNCH]=new Item("Miracle Food Lunch","It doesn't taste very good, but it's said to have miracoulous powers when consumed.",{hpRecovery:30,ppRecovery:10,atkIncrease:30,spdIncrease:6,hpIncrease:150,ppIncrease:100,learnAbility:MOVELIST[BattleMoveName::PKFIRE_O],consumable:Consumable::FRIENDLY_PERMANENT});
ITEMLIST[ItemName::BOMB]=new Item("Bomb","A small explosive device. Deals around 120 damage.",{damage:110,rollDmg:30,consumable:Consumable::ENEMY});
ITEMLIST[ItemName::CRACKED_BAT]=new Item("Cracked Bat","Has some dents in it, but you can probably still dent things with it yourself.",{attack:10,equip:EquipSlot::WEAPON});
ITEMLIST[ItemName::TEE_BALL_BAT]=new Item("Tee Ball Bat","Great for playing some ball! Also great for beating your foes!",{attack:40,equip:EquipSlot::WEAPON});
ITEMLIST[ItemName::LIGHT_JACKET]=new Item("Light Jacket","Fits just fine.",{defense:10,equip:EquipSlot::ARMOR});
ITEMLIST[ItemName::HEAVY_JACKET]=new Item("Heavy Jacket","Are you sure this is good for your shoulders?",{defense:25,equip:EquipSlot::ARMOR});
ITEMLIST[ItemName::COPPER_BRACELET]=new Item("Copper Bracelet","It's not quite as shiny as a diamond, but it still makes you look good.",{defense:5,equip:EquipSlot::ACCESSORY});
ITEMLIST[ItemName::KEY_TO_THE_PALACE]=new Item("Key to the Palace","Lets you access a Palace.",{important:true});
ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",2,{hpRecovery:40,consumable:Consumable::FRIENDLY});
ITEMLIST[ItemName::EGG]=new Item("Egg","Did it come before or after the chicken? Restores 60 HP.",3,{hpRecovery:60,consumable:Consumable::FRIENDLY});
ITEMLIST[ItemName::PIZZA]=new Item("Pizza","A scrumptious meal filled with lots of cheese. Restores 200 HP.",4,{hpRecovery:200,consumable:Consumable::FRIENDLY});
ITEMLIST[ItemName::MIRACLE_FOOD_LUNCH]=new Item("Miracle Food Lunch","It doesn't taste very good, but it's said to have miracoulous powers when consumed.",16,{hpRecovery:30,ppRecovery:10,atkIncrease:30,spdIncrease:6,hpIncrease:150,ppIncrease:100,learnAbility:MOVELIST[BattleMoveName::PKFIRE_O],consumable:Consumable::FRIENDLY_PERMANENT});
ITEMLIST[ItemName::BOMB]=new Item("Bomb","A small explosive device. Deals around 120 damage.",256,{damage:110,rollDmg:30,consumable:Consumable::ENEMY});
ITEMLIST[ItemName::CRACKED_BAT]=new Item("Cracked Bat","Has some dents in it, but you can probably still dent things with it yourself.",256,{attack:10,equip:EquipSlot::WEAPON});
ITEMLIST[ItemName::TEE_BALL_BAT]=new Item("Tee Ball Bat","Great for playing some ball! Also great for beating your foes!",256,{attack:40,equip:EquipSlot::WEAPON});
ITEMLIST[ItemName::LIGHT_JACKET]=new Item("Light Jacket","Fits just fine.",256,{defense:10,equip:EquipSlot::ARMOR});
ITEMLIST[ItemName::HEAVY_JACKET]=new Item("Heavy Jacket","Are you sure this is good for your shoulders?",256,{defense:25,equip:EquipSlot::ARMOR});
ITEMLIST[ItemName::COPPER_BRACELET]=new Item("Copper Bracelet","It's not quite as shiny as a diamond, but it still makes you look good.",256,{defense:5,equip:EquipSlot::ACCESSORY});
ITEMLIST[ItemName::KEY_TO_THE_PALACE]=new Item("Key to the Palace","Lets you access a Palace.",256,{important:true});
}
void SetupAnimations() {
@ -2169,6 +2185,11 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MOVELIST[BattleMoveName::TESTMOVE1],
MOVELIST[BattleMoveName::TESTMOVE2],
MOVELIST[BattleMoveName::TESTMOVE3],
},{
ITEMLIST[ItemName::COOKIE],
ITEMLIST[ItemName::EGG],
ITEMLIST[ItemName::PIZZA],
ITEMLIST[ItemName::MIRACLE_FOOD_LUNCH],
}),
new Entity(new Object(
NPC1_4,"Test Obj 2",1,2,ANIMATIONS["player.png"],{2,2},GREEN,20),
@ -2176,6 +2197,11 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MOVELIST[BattleMoveName::TESTMOVE1],
MOVELIST[BattleMoveName::TESTMOVE2],
MOVELIST[BattleMoveName::TESTMOVE3],
},{
ITEMLIST[ItemName::COOKIE],
ITEMLIST[ItemName::EGG],
ITEMLIST[ItemName::PIZZA],
ITEMLIST[ItemName::MIRACLE_FOOD_LUNCH],
}),
new Entity(new Object(
NPC1_4,"Test Obj 3",2,1,ANIMATIONS["player.png"],{2,2},GREEN,20),
@ -2183,6 +2209,11 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MOVELIST[BattleMoveName::TESTMOVE1],
MOVELIST[BattleMoveName::TESTMOVE2],
MOVELIST[BattleMoveName::TESTMOVE3],
},{
ITEMLIST[ItemName::COOKIE],
ITEMLIST[ItemName::EGG],
ITEMLIST[ItemName::PIZZA],
ITEMLIST[ItemName::MIRACLE_FOOD_LUNCH],
}),
}));//ENCOUNTER_2
ENCOUNTER_LIST.push_back(new Encounter(encounter::ENCOUNTER_3,{0,0},std::array<vd2d,4>{vd2d
@ -2898,8 +2929,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
}
if (!enemyStillAlive) {
BATTLE_ENCOUNTER=nullptr;
BATTLE_STATE=BattleState::MOVE_CAMERA;
for (int i=0;i<PARTY_MEMBER_COUNT;i++) {
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb=0;
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->selectedMove=nullptr;
@ -2911,12 +2940,57 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
}
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->_SetDirectPP(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->GetTargetPP());
}
BATTLE_STATE=BattleState::ENEMY_SPOILS;
}
CURRENT_TURN=-99;
BATTLE_CUSTOM_MESSAGE_WAIT_TIME=0;
BATTLE_CUSTOM_MSGS.clear();
BATTLE_CURRENT_CUSTOM_MSG={};
BATTLE_ANIMATION_TIMER=0;
BATTLE_SPOILS_MESSAGE=L"";
}
}break;
case BattleState::ENEMY_SPOILS:{
if (BATTLE_ANIMATION_TIMER==0) {
BATTLE_SPOILS_LIST.clear();
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
for (int j=0;j<BATTLE_ENCOUNTER->objs[i]->inventory.size();j++) {
if (rand()%BATTLE_ENCOUNTER->objs[i]->inventory[j]->dropChance==0) {
BATTLE_SPOILS_LIST.push_back(BATTLE_ENCOUNTER->objs[i]->inventory[j]);
}
}
}
}
if (BATTLE_ANIMATION_TIMER%90==0) {
if (BATTLE_SPOILS_LIST.size()>0) {
BATTLE_SPOILS_MESSAGE=L"You obtained a";
BATTLE_SPOILS_MESSAGE+=((
BATTLE_SPOILS_LIST[0]->name[0]=='a'||
BATTLE_SPOILS_LIST[0]->name[0]=='e'||
BATTLE_SPOILS_LIST[0]->name[0]=='i'||
BATTLE_SPOILS_LIST[0]->name[0]=='o'||
BATTLE_SPOILS_LIST[0]->name[0]=='u'||
BATTLE_SPOILS_LIST[0]->name[0]=='A'||
BATTLE_SPOILS_LIST[0]->name[0]=='E'||
BATTLE_SPOILS_LIST[0]->name[0]=='I'||
BATTLE_SPOILS_LIST[0]->name[0]=='O'||
BATTLE_SPOILS_LIST[0]->name[0]=='U'
)?L"n ":L" ");
BATTLE_SPOILS_MESSAGE+=transform_to<std::wstring>(BATTLE_SPOILS_LIST[0]->name)+L".";
PARTY_INVENTORY.push_back(BATTLE_SPOILS_LIST[0]);
BATTLE_SPOILS_LIST.erase(BATTLE_SPOILS_LIST.begin());
} else {
BATTLE_STATE=BattleState::MOVE_CAMERA_BACK;
}
}
BATTLE_ANIMATION_TIMER++;
}break;
case BattleState::MOVE_CAMERA_BACK:{
const vi2d cameraOffset={WIDTH/2,HEIGHT/2};
if (MoveCameraTowardsPoint(PARTY_MEMBER_OBJ[0]->GetPos()-cameraOffset,PriorityDirection::BOTH,BATTLE_CAMERA_MOVESPD)) {
BATTLE_ENCOUNTER=nullptr;
BATTLE_STATE=BattleState::MOVE_CAMERA;
}
}break;
case BattleState::SELECT_ACTION:
@ -3304,7 +3378,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MOVELIST[BattleMoveName::CONSUMABLE_ENEMY]->randomDmg=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.rollDmg;
}
if ((PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.consumable==Consumable::FRIENDLY||PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.consumable==Consumable::ENEMY)) {
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->RemoveItem(ITEM_SELECTION_CURSOR);
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->RemoveItem(ITEM_SELECTION_CURSOR);
}
}
if (ITEM_SELECTION_CURSOR>=PARTY_INVENTORY.size()&&prevPartyInvenSize&1&&PARTY_INVENTORY.size()==prevPartyInvenSize-1) {

@ -60,6 +60,24 @@ class LineParticle:public Particle{
}
};
class StaticLineParticle:public Particle{
public:
Pixel col;
vd2d pos2;
vd2d PickRandomPos() {
return {rand()%100/100.0F*WIDTH,rand()%800/10.0F-40+HEIGHT/2};
}
StaticLineParticle(int lifetime,Pixel col=WHITE,bool wrap=false)
:col(col),pos2(PickRandomPos()),Particle(PickRandomPos(),{0,0},{0,0},lifetime,wrap){}
void particleUpdate()override{
pos+={(rand()%100/100.0F-0.5)*20,(rand()%50/100.0F-0.25)*10};
pos2+={(rand()%100/100.0F-0.5)*20,(rand()%50/100.0F-0.25)*10};
}
void render(PixelGameEngine*game)override{
game->FillRectDecal(pos,pos2-pos,col);
}
};
class SquareParticle:public Particle{
private:
vd2d size;
@ -93,4 +111,28 @@ class WaterParticle:public Particle{
game->FillRectDecal(pos,size,col);
}
};
class FireParticle:public Particle{
private:
vd2d size;
vd2d PickRandomSpd() {
return {rand()%60/10.0F-3,(rand()%100/100.0F-0.5)*10};
}
vd2d PickRandomPos() {
return {rand()%100/100.0F*WIDTH,HEIGHT/2};
}
public:
Pixel col;
FireParticle(vd2d size,vd2d acc,int lifetime,Pixel col=WHITE)
:col(col),size(size),Particle(PickRandomPos(),PickRandomSpd(),acc,lifetime){}
void particleUpdate()override{
if (this->pos.y>HEIGHT) {
this->spd=PickRandomSpd();
this->pos=PickRandomPos();
}
}
void render(PixelGameEngine*game)override{
game->FillRectDecal(pos,size,col);
}
};
#endif

@ -21,6 +21,8 @@ namespace BattleState{
ITEM_SELECT,
TARGET_SELECT,
MOVE_SELECT,
ENEMY_SPOILS,
MOVE_CAMERA_BACK,
};
}
#endif
Loading…
Cancel
Save