Created
December 22, 2016 12:28
-
-
Save localdevm/28bf14ff3d15d9df0e19e31aae7417f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Collision(Level activelevel) | |
{ | |
for (int x = 0; x < activelevel.Length; x++) | |
{ | |
for (int y = 0; y < activelevel.Height; y++) | |
{ | |
if (activelevel.blokTileArray[x, y] != null) | |
{ | |
if (this.ColRectangle.Bottom +6> activelevel.blokTileArray[x, y].ColRectangle.Top && | |
this.ColRectangle.Right - 20> activelevel.blokTileArray[x,y].ColRectangle.Left && | |
this.ColRectangle.Left + 20 < activelevel.blokTileArray[x, y].ColRectangle.Right && | |
this.ColRectangle.Top < activelevel.blokTileArray[x, y].ColRectangle.Bottom) | |
{ | |
falling = false; | |
position.Y = activelevel.blokTileArray[x, y].ColRectangle.Top - 70; | |
} | |
else | |
{ | |
falling = true; | |
} | |
//SHIT LIKE ME!!! | |
if (this.ColRectangle.Right - 20 >= activelevel.blokTileArray[x, y].ColRectangle.Left && | |
this.ColRectangle.Right + 20 <= activelevel.blokTileArray[x, y].ColRectangle.Right && | |
this.ColRectangle.Bottom < activelevel.blokTileArray[x,y].ColRectangle.Top && | |
this.ColRectangle.Top > activelevel.blokTileArray[x,y].ColRectangle.Bottom) | |
{ | |
//this.position.X -= 4; | |
right = false; | |
} | |
//WORKS GREAT!!! | |
if (this.ColRectangle.Left + 20 <= activelevel.blokTileArray[x, y].ColRectangle.Right && | |
this.ColRectangle.Left - 20 >= activelevel.blokTileArray[x, y].ColRectangle.Left && | |
this.ColRectangle.Bottom > activelevel.blokTileArray[x, y].ColRectangle.Top && | |
this.ColRectangle.Top < activelevel.blokTileArray[x, y].ColRectangle.Bottom) | |
{ | |
//this.position.X += 4; | |
left = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment