Pre-raw pointer phase

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent c7eec514b5
commit dc9404d220
  1. 8
      Board.cpp
  2. BIN
      C++ProjectTemplate
  3. 1
      Meteos.h
  4. 11
      main.cpp

@ -56,9 +56,11 @@ void Board::convertClump(int ind){
BlockClump c2;
for (int i=0;i<c.getBlocks().size();i++) {
Block&b2=c.getBlocks()[i];
if (c.getBlockPosition(b).x==b2.pos.x) {
b2.markedForDeletion=true;
c2.addBlock(b2.pos,b2.col);
if (!b2.markedForDeletion) {
if (c.getBlockPosition(b).x==b2.pos.x) {
b2.markedForDeletion=true;
c2.addBlock(b2.pos,b2.col);
}
}
c2.y=c.y;
}

Binary file not shown.

@ -14,6 +14,7 @@ class Meteos : public olc::PixelGameEngine{
std::mt19937 gen;
Board gameBoard;
std::map<std::string,Renderable> SPRITES;
bool onlyOnce=false;
bool OnUserCreate()override;
bool OnUserUpdate(float fElapsedTime)override;
};

@ -24,6 +24,17 @@ bool Meteos::OnUserCreate()
bool Meteos::OnUserUpdate(float fElapsedTime)
{
fElapsedTime=std::min(fElapsedTime,1/60.f);
if (!onlyOnce) {
BlockClump c;
c.addBlock(1,0,BlockColor::RED);
c.addBlock(2,0,BlockColor::RED);
c.addBlock(0,0,BlockColor::RED);
c.addBlock(0,1,BlockColor::RED);
c.addBlock(0,2,BlockColor::RED);
c.y=120;
gameBoard.addClump(c);
onlyOnce=true;
}
lastBlockSpawn+=fElapsedTime;
if (lastBlockSpawn>=gameBoard.spawnRate){
lastBlockSpawn-=gameBoard.spawnRate;

Loading…
Cancel
Save