|
|
|
@ -17,7 +17,7 @@ bool Meteos::OnUserCreate() |
|
|
|
|
randBlockPos=std::uniform_int_distribution<>(0, 9); |
|
|
|
|
coinFlip=std::uniform_int_distribution<>(0, 1); |
|
|
|
|
|
|
|
|
|
gameBoard=Board({10,14},0.04f,1.2f,-1.f,1.7f,1.0f,{3,0,0,0,0,0,0,0,0,0},SPRITES["blocks_test.png"]); |
|
|
|
|
gameBoard=Board({10,14},0.04f,1.2f,-1.f,1.7f,2.0f,1.0f,{3,0,0,0,0,0,0,0,0,0},SPRITES["blocks_test.png"]); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -29,7 +29,7 @@ bool Meteos::OnUserUpdate(float fElapsedTime) |
|
|
|
|
updateGame(1/60.0f); |
|
|
|
|
accumulatedTime=0; |
|
|
|
|
} |
|
|
|
|
drawGame(); |
|
|
|
|
drawGame(fElapsedTime); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -43,6 +43,15 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
|
BlockClump&c=gameBoard.getBlockClumps()[i]; |
|
|
|
|
if (c.launchTime>0) { |
|
|
|
|
c.launchTime-=fElapsedTime; |
|
|
|
|
} else
|
|
|
|
|
if (c.landTime>0) { |
|
|
|
|
c.landTime-=fElapsedTime; |
|
|
|
|
if (c.landTime<=0) { |
|
|
|
|
c.landTime=0; |
|
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
|
gameBoard.assignRandomColor(c.getBlocks()[j]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
c.vspeed+=gameBoard.gravity; |
|
|
|
|
} |
|
|
|
@ -357,7 +366,7 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Meteos::drawGame(){ |
|
|
|
|
void Meteos::drawGame(float fElapsedTime){ |
|
|
|
|
Clear(Pixel(32,32,255)); |
|
|
|
|
for (int x=-1;x<=gameBoard.boardSize.x;x++){ |
|
|
|
|
for (int y=0;y<=gameBoard.boardSize.y;y++){ |
|
|
|
@ -372,12 +381,26 @@ void Meteos::drawGame(){ |
|
|
|
|
BlockClump&c=gameBoard.getBlockClumps()[i]; |
|
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
|
Block&b=c.getBlocks()[j]; |
|
|
|
|
if (b.resetTime>0) { |
|
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
|
if (b.resetTime<0) { |
|
|
|
|
b.resetTime=0; |
|
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawPartialDecal(c.getBlockPosition(b)+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<gameBoard.boardSize.x;i++){ |
|
|
|
|
for (int y=0;y<gameBoard.getBlocks(i).size();y++){ |
|
|
|
|
Block&b=gameBoard.getBlocks(i)[y]; |
|
|
|
|
if (b.resetTime>0) { |
|
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
|
if (b.resetTime<0) { |
|
|
|
|
b.resetTime=0; |
|
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawPartialDecal(b.pos+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|