Example #1
0
 public void ResolveCollision(Player player, DrawData item)
 {
     Rectangle overlap = Rectangle.Intersect(player.Destination, item.Destination);
     player.Position -= new Vector2(overlap.X, overlap.Y);
     player.Velocity = new Vector2(0, 0);
     player.VelocityGravity = new Vector2(0, 0);
 }
Example #2
0
 public void AddDrawable(DrawData drawable)
 {
     if (drawable == null || _toDraw.Contains(drawable))
     {
         Console.WriteLine("Unable to add drawable!");
         return;
     }
     _toDraw.Add(drawable);
 }
Example #3
0
 private void AddLevelObjects()
 {
     _levelObjects.Add(_player);
     _floor01 = new DrawData(_terrainArt, new Rectangle(0, 0, 67, 10));
     _floor01.Position = new Vector2(0, 200);
     _levelObjects.Add(_floor01);
     _floor02 = new DrawData(_terrainArt, new Rectangle(0, 0, 67, 10));
     _floor02.Position = new Vector2(68, 200);
     _levelObjects.Add(_floor02);
 }
Example #4
0
 public bool IsCollision(Player player, DrawData item)
 {
     if (player.Destination.Intersects(item.Destination))
         return true;
     return false;
 }
Example #5
0
 public void RemoveDrawable(DrawData toRemove)
 {
     _toDraw.Remove(toRemove);
 }
Example #6
0
 protected virtual void drawElement(DrawData drawable)
 {
     _drawer.Draw(drawable.Art,drawable.Destination,
         drawable.Source, Color.White);
 }