Esempio n. 1
0
 public Game(uint antialias, bool hq)
 {
     settings = new ContextSettings();
     settings.AntialiasingLevel = antialias;
     player = new Player();
     level = new Level();
     highQuality = hq;
 }
Esempio n. 2
0
 public void Draw(RenderTarget window, Player player)
 {
     for (int x = 0; x < Width; x++)
     {
         for (int y = 0; y < Height; y++)
         {
             Block b = Blocks[x, y];
             Tile.Texture = Tiles;
             Tile.TextureRect = b.Texture;
             Tile.Position = new Vector2f(x * 32, y * 32) + offset.Vec2f;
             window.Draw(Tile);
         }
     }
     if (Office)
     {
         Tile.Texture = Sitting;
         Tile.TextureRect = new IntRect(0, 0, 16, 16);
         Tile.Position = new Vector2f(3 * 32 + 6, 2 * 32 - 12) + offset.Vec2f;
         window.Draw(Tile);
     }
     List<Entity> toRemove = new List<Entity>();
     for (int i = 0; i < Entities.Count; i++)
     {
         Entities[i].Rotate(player.Location.Vec2i);
         if (Entities[i].Location.DistSquared(player.Location) <= 20 * 32 * 32)
         {
             Entities[i].Move(-0.8f, 0);
         }
         int r = Move(Entities[i].PreUpdate());
         if (r == 1)
         {
             Entities[i].Update();
         }
         else if (r == 2) toRemove.Add(Entities[i]);
         else Entities[i].Stuck();
         Entities[i].Draw(window, offset);
     }
     foreach (Entity e in toRemove)
     {
         Entities.Remove(e);
     }
     toRemove.Clear();
 }