public override void Update(MainGame game, EntityContainer parent, GameTime time)
 {
     foreach (Entity item in this.Items)
     {
         item.Update(game, this, time);
     }
 }
 public override void Draw(MainGame game, EntityContainer parent)
 {
     foreach (Entity item in this.Items)
     {
         item.Draw(game, this);
     }
 }
Example #3
0
 public Tileset(MainGame game, string imageName, int tileWidth, int tileHeight)
 {
     this._tilesetImage = game.GetTexture(imageName);
     this.TileWidth = tileWidth;
     this.TileHeight = tileHeight;
     this.Width = this._tilesetImage.Width / tileWidth;
     this.Height = this._tilesetImage.Height / tileHeight;
 }
Example #4
0
 public void DrawTile(MainGame game, int x, int y, int index)
 {
     if (index == 0)
     {
         return;
     }
     Rectangle rect = new Rectangle(x * this.TileWidth, y * this.TileHeight, this.TileWidth, this.TileHeight);
     game.DrawImage(_tilesetImage, rect, GetTileRect(index), Color.White);
 }
Example #5
0
 private void DoMove(MainGame game, float x, float y)
 {
     if (Physics.Colides(MoveSimulate(x,y), this))
     {
         return;
     }
     Move(x, y);
     game.MoveCamera(x, y);
 }
Example #6
0
        public void Draw(MainGame game, int x, int y)
        {
            atmosTile.Draw(game, x, y);

            for (int i = 0; i < maxTile; i++)
            {
                if (tiles.ContainsKey(i))
                {
                    tiles[i].Draw(game, x, y);
                }
            }
        }
Example #7
0
        public override void Update(MainGame game, EntityContainer parent, GameTime time)
        {
            if (game.IsKeyDown(Keys.W) || game.IsKeyDown(Keys.Up))
            {
                DoMove(game, 0, (float)time.ElapsedGameTime.Milliseconds / 5);
            }

            if (game.IsKeyDown(Keys.S) || game.IsKeyDown(Keys.Down))
            {
                DoMove(game, 0, -(float)time.ElapsedGameTime.Milliseconds / 5);
            }

            if (game.IsKeyDown(Keys.A) || game.IsKeyDown(Keys.Left))
            {
                DoMove(game, (float)time.ElapsedGameTime.Milliseconds / 5, 0);
            }

            if (game.IsKeyDown(Keys.D) || game.IsKeyDown(Keys.Right))
            {
                DoMove(game, -(float)time.ElapsedGameTime.Milliseconds / 5, 0);
            }
        }
Example #8
0
 public override void Draw(MainGame game, EntityContainer parent)
 {
     game.DrawImage("player", new Rectangle(MainGame.WindowWidth / 2 - 8, MainGame.WindowHeight / 2 - 8, LivingEntSize, LivingEntSize), true);
 }
Example #9
0
 public virtual void Draw(MainGame game, int x, int y)
 {
     if (this.NoDraw)
     {
         return;
     }
     game.DrawImage(new Rectangle(x * SSMap.TileSize, y * SSMap.TileSize, SSMap.TileSize, SSMap.TileSize), this.DisplayColor);
 }
Example #10
0
 public virtual void Update(MainGame game, GameTime time)
 {
 }
Example #11
0
 public override void Update(MainGame game, EntityContainer parent, GameTime time)
 {
     Rectangle seenBounds = game.CameraBounds;
     for (int x = seenBounds.X / TileSize; x < (seenBounds.X + seenBounds.Width) / TileSize + 2; x++)
     {
         for (int y = seenBounds.Y / TileSize; y < (seenBounds.Y + seenBounds.Height) / TileSize + 1 + 2; y++)
         {
             if (x >= Width || x < 0 || y >= Height || y < 0)
             {
                 continue;
             }
             Map[x, y].Update(game, time);
         }
     }
 }
Example #12
0
 public void Update(MainGame game, GameTime time)
 {
     atmosTile.Update(game, time);
 }
Example #13
0
 public virtual void Update(MainGame game, EntityContainer parent, GameTime time)
 {
 }
Example #14
0
 public virtual void Draw(MainGame game, EntityContainer parent)
 {
 }
Example #15
0
 public override void Draw(MainGame game, int x, int y)
 {
     tileSet.DrawTile(game, x, y, tileIndex);
 }