Quote:
Originally Posted by Tiptup300
snippits would be helpful, you're not giving very much information that could be helpful.
|
Basically this class Draw from the .txt File:
[
n.b. itsnotabigtruck: redacted on request of author]
And this is the Collision class:
Code:
int Rows;
int Columns;
int X { get; set; }
int Y { get; set; }
Rectangle rec;
Texture2D CollisionCheck;
SpriteFont font;
Vector2 vector = new Vector2(0, 0);
public int GetIndex(Point pt, Grid grid)
{
int row = pt.Y / Grid.CellHeight;
int col = pt.X / Grid.CellWidth;
int index = row * grid.Columns + col;
return index;
}
public void CalculateCollisions(Point pt, Grid grid, Sprite sprite)
{
for (int i = 0; i < grid.Columns; i++)
{
//GetIndex(pt, grid);
if (grid[GetIndex(pt, grid)] == 1)
{
if (sprite.X > (int)grid.location.X - sprite.Width)
{
}
//sprite.Position.Y = (int)grid.location.Y - Grid.CellHeight * 2 - sprite.Height;
}
if (grid[GetIndex(pt, grid)] == 2)
{
}
}
}
}