|
|
@ -17,7 +17,7 @@ bool Meteos::OnUserCreate() |
|
|
|
randBlockPos=std::uniform_int_distribution<>(0, 9); |
|
|
|
randBlockPos=std::uniform_int_distribution<>(0, 9); |
|
|
|
coinFlip=std::uniform_int_distribution<>(0, 1); |
|
|
|
coinFlip=std::uniform_int_distribution<>(0, 1); |
|
|
|
|
|
|
|
|
|
|
|
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"]); |
|
|
|
gameBoard=Board({10,14},0.04f,1.2f,-1.f,1.7f,2.0f,1.0f,{3,3,0,0,0,0,0,0,0,0},SPRITES["blocks_test.png"]); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -49,7 +49,9 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
if (c.landTime<=0) { |
|
|
|
if (c.landTime<=0) { |
|
|
|
c.landTime=0; |
|
|
|
c.landTime=0; |
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
for (int j=0;j<c.getBlocks().size();j++){ |
|
|
|
gameBoard.assignRandomColor(c.getBlocks()[j]); |
|
|
|
if (c.getBlocks()[j].col==BlockColor::LAUNCHED) { |
|
|
|
|
|
|
|
gameBoard.assignRandomColor(c.getBlocks()[j]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -68,10 +70,11 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
if (c2.getBlockPosition(b2).x==c.getBlockPosition(b3).x&& |
|
|
|
if (c2.getBlockPosition(b2).x==c.getBlockPosition(b3).x&& |
|
|
|
c2.getBlockPosition(b2).y+12>=c.getBlockPosition(b3).y&& |
|
|
|
c2.getBlockPosition(b2).y+12>=c.getBlockPosition(b3).y&& |
|
|
|
c2.getBlockPosition(b2).y<=c.getBlockPosition(b3).y+12) { |
|
|
|
c2.getBlockPosition(b2).y<=c.getBlockPosition(b3).y+12) { |
|
|
|
float yDiff=c2.getBlockPosition(b2).y; |
|
|
|
float yDiff=(c2.getBlockPosition(b2).y>c.getBlockPosition(b3).y)? |
|
|
|
float snapYPos=c.getBlockPosition(b3).y; |
|
|
|
c2.getBlockPosition(b2).y-c.getBlockPosition(b3).y: |
|
|
|
yDiff-=snapYPos; |
|
|
|
c.getBlockPosition(b3).y-c2.getBlockPosition(b2).y; |
|
|
|
c2.y+=yDiff; |
|
|
|
c2.y+=(c2.getBlockPosition(b2).y>c.getBlockPosition(b3).y)? |
|
|
|
|
|
|
|
yDiff:-yDiff; |
|
|
|
float influence=(float)c.getBlocks().size()/(c.getBlocks().size()+c2.getBlocks().size()); |
|
|
|
float influence=(float)c.getBlocks().size()/(c.getBlocks().size()+c2.getBlocks().size()); |
|
|
|
int blockCount=c.getBlocks().size(); |
|
|
|
int blockCount=c.getBlocks().size(); |
|
|
|
//Copy every block from one clump to the other
|
|
|
|
//Copy every block from one clump to the other
|
|
|
@ -385,7 +388,9 @@ void Meteos::drawGame(float fElapsedTime){ |
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
if (b.resetTime<0) { |
|
|
|
if (b.resetTime<0) { |
|
|
|
b.resetTime=0; |
|
|
|
b.resetTime=0; |
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
if (b.col==BlockColor::LAUNCHED) { |
|
|
|
|
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
DrawPartialDecal(c.getBlockPosition(b)+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
|
DrawPartialDecal(c.getBlockPosition(b)+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
@ -398,7 +403,9 @@ void Meteos::drawGame(float fElapsedTime){ |
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
b.resetTime-=fElapsedTime; |
|
|
|
if (b.resetTime<0) { |
|
|
|
if (b.resetTime<0) { |
|
|
|
b.resetTime=0; |
|
|
|
b.resetTime=0; |
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
if (b.col==BlockColor::LAUNCHED) { |
|
|
|
|
|
|
|
gameBoard.assignRandomColor(b); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
DrawPartialDecal(b.pos+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
|
DrawPartialDecal(b.pos+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); |
|
|
|