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);
     }
 }
Exemple #3
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);
            }
        }
Exemple #4
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);
 }
Exemple #5
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);
         }
     }
 }
Exemple #6
0
 public virtual void Update(MainGame game, EntityContainer parent, GameTime time)
 {
 }
Exemple #7
0
 public virtual void Draw(MainGame game, EntityContainer parent)
 {
 }
Exemple #8
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _Batch = new SpriteBatch(GraphicsDevice);

            Container = new EntityContainer();

            LoadAllContent();

            OnInit();

            Container.Update();

            // TODO: use this.Content to load your game content here
        }