collistionstest


SUBMITTED BY: Thor2607

DATE: Sept. 28, 2016, 7:16 p.m.

FORMAT: C#

SIZE: 621 Bytes

HITS: 426

  1. private bool pixcol(gObj obj){
  2. Matrix t = obj.m * Matrix.Invert(m) * Matrix.CreateTranslation(0.5f, 0.5f, 0);
  3. for (int x = 0; x < size.X; ++x) for (int y = 0; y < size.Y; y++)
  4. {
  5. if (col[(int)(x + y * size.X)].A == 0) continue;
  6. Vector2 p = Vector2.Transform(new Vector2(x, y), t);
  7. {
  8. int x2 = (int)p.X;
  9. int y2 = (int)p.Y;
  10. }
  11. if (!(!(x2 < 0 || x2 > obj.size.X) && !(y2 < 0 || y2 > obj.size.Y))) continue;
  12. if (obj.col[(int)(x2 + y2 * obj.size.X)%(obj.size.x*obj.size.y)].A > 0) return true;
  13. }
  14. return false;
  15. }

comments powered by Disqus