public Element(Texture2D aSprite, Vector2 aPosition, Vector2 aSpeed, int numFrames) { activated = false; hasBeenHit = -1; endSequence = false; sprite = aSprite; position = aPosition; speed = aSpeed; frameCounter = 0; frameSize = sprite.Width / numFrames; drawable = true; hasEndingSequence = false; ourBox = new CollisionBox(aPosition, new Vector2(aPosition.X + aSprite.Width/numFrames, aPosition.Y + aSprite.Height)); }
public int Intersect(CollisionBox box) { int side = -1; BoundingBox ex = box.getEntireObject(); if (ex.Intersects(left)) { side = 1; }else if(ex.Intersects(top)){ side = 2; } else if (ex.Intersects(right)) { side = 3; } else if (ex.Intersects(bottom)) { side = 4; } return side; }
public Boolean IntersectRight(CollisionBox box) { BoundingBox ex = box.getEntireObject(); return ex.Intersects(right); }
public Boolean IntersectBottom(CollisionBox box) { BoundingBox ex = box.getEntireObject(); return ex.Intersects(bottom); }
public Boolean IntersectTop(CollisionBox box) { BoundingBox ex = box.getEntireObject(); Boolean ans = ex.Intersects(top); if (ans) { ans = ans; } return ans; }