Skip to content

Commit

Permalink
merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriy Katkov committed Feb 9, 2014
2 parents 351724b + c4d814e commit d278f40
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
Binary file not shown.
Binary file modified bin/classes/com/example/avalanchegame/CustomSurfaceView.class
Binary file not shown.
9 changes: 5 additions & 4 deletions src/com/example/avalanchegame/Box.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void adjustPosition(int deltaT)

public boolean isMoving()
{
return vy != 0;
return Math.abs(vy) > 0.01f;
}


Expand Down Expand Up @@ -230,7 +230,7 @@ public void fixIntersection(RectF other, int whichSide)
{
if (whichSide == 1)
{
float amount = other.left - this.right - 0.5f;
float amount = other.left - this.right - 30.5f;
offset(amount, 0);

x += amount;
Expand All @@ -247,9 +247,10 @@ else if (whichSide == 2) // bottom
}
else if(whichSide == 3)
{
float amount = other.right - this.left + 0.5f;
float amount = other.right - this.left + 30.5f;
//Log.d("asdf", +other.right+", "+this.left);
offset(amount, 0);

//Log.d("asdf", +other.right+", "+this.left);
x += amount;
}
}
Expand Down
37 changes: 26 additions & 11 deletions src/com/example/avalanchegame/CustomSurfaceView.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,28 +174,22 @@ public void generateBoxes(float startingHeight, float additionalHeight)
{
for (float spawnHeight = startingHeight; spawnHeight <= startingHeight
+ additionalHeight; spawnHeight +=
seededRandom.nextFloat() * mCanvasHeight / 2 + mCanvasHeight
seededRandom.nextFloat() * mCanvasHeight / 3 + mCanvasHeight
/ 5)
{
int amountPerHeight = seededRandom.nextInt(2) + 1;
for (int i = 0; i < amountPerHeight; i++)
{
int width = randInt(minWidth, maxWidth) * 2;
int x = randInt(0, mCanvasWidth);
boolean collisions = true;
Box box = new Box(x, spawnHeight, width, boxFallSpeed);
collisions = false;
for (Box block : boxes)
{
int temp = box.intersects(block);
if (temp > -1)
{
Log.d("asdf", spawnHeight + "INTERSECTION");
box.fixIntersection(block, temp);
}
box.fixIntersection(block, box.intersects(block));
block.fixIntersection(box, block.intersects(box));
}
if (box.top > maxBlockHeight)
maxBlockHeight = box.top;
// if (box.top > maxBlockHeight)
// maxBlockHeight = box.top;
boxes.add(box);
}
}
Expand Down Expand Up @@ -574,6 +568,21 @@ private void updateLogic()
if (blocksAbovePlayer < MIN_BLOCKS_ABOVE)
{
generateBoxes(maxBlockHeight, spawnIncrements);
// Box box1 =
// new Box(60, mCanvasHeight * .8f, maxWidth, boxFallSpeed);
// boxes.add(box1);
// Box box2 =
// new Box(
// 90,
// mCanvasHeight * .8f,
// maxWidth * .8f,
// boxFallSpeed);
// Log.d("fdsa", box1.toString() + ", " + box2.toString());
// box1.fixIntersection(box2, box1.intersects(box2));
// Log.d("fdsa", box1.toString() + ", " + box2.toString());
// // box2.fixIntersection(box1, box2.intersects(box1));
// Log.d("fdsa", box1.toString() + ", " + box2.toString());
// boxes.add(box2);
Log.d("spawn", "SENDING MOAR BLOCKS");
}
maxBlockHeight = 0;
Expand All @@ -591,9 +600,15 @@ private void updateLogic()
{
int collisionIndicator =
block.intersects(possibleCollisionBlock);
if (collisionIndicator > -1)
{
Log.d("fdsa", block.toString() + ", "
+ possibleCollisionBlock.toString());
}
block.fixIntersection(
possibleCollisionBlock,
collisionIndicator);

}
}
if (block.top > maxBlockHeight)
Expand Down

0 comments on commit d278f40

Please sign in to comment.