Exemplo n.º 1
0
 public override void Update(MainGame game, EntityContainer parent, GameTime time)
 {
     foreach (Entity item in this.Items)
     {
         item.Update(game, this, time);
     }
 }
Exemplo n.º 2
0
 public override void Draw(MainGame game, EntityContainer parent)
 {
     foreach (Entity item in this.Items)
     {
         item.Draw(game, this);
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 10
0
 public virtual void Update(MainGame game, GameTime time)
 {
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 12
0
 public void Update(MainGame game, GameTime time)
 {
     atmosTile.Update(game, time);
 }
Exemplo n.º 13
0
 public virtual void Update(MainGame game, EntityContainer parent, GameTime time)
 {
 }
Exemplo n.º 14
0
 public virtual void Draw(MainGame game, EntityContainer parent)
 {
 }
Exemplo n.º 15
0
 public override void Draw(MainGame game, int x, int y)
 {
     tileSet.DrawTile(game, x, y, tileIndex);
 }