Пример #1
0
 public virtual void Draw(SpriteBatch batch, Vector2 position, int frameIndex, StageCamera camera)
 {
     batch.Draw(m_sprite, camera.ToCameraPosition(position), m_sourceRects[frameIndex], Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0);
 }
Пример #2
0
 public virtual void Draw(SpriteBatch batch, Vector2 position, StageCamera camera)
 {
     position.X += m_currentAnimation[m_currentFrame].XOffset;
     position.Y += m_currentAnimation[m_currentFrame].YOffset;
     SpriteEffects effects = m_currentAnimation[m_currentFrame].Mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
     batch.Draw(m_sprite.Texture,
                camera.ToCameraPosition(position),
                m_sprite.GetSourceFrame(m_currentAnimation[m_currentFrame].FrameIndex),
                Color.White, 0, Vector2.Zero, 1, effects, 0);
 }
Пример #3
0
 public void Draw(SpriteBatch batch, StageCamera camera)
 {
     m_playerSprite.Draw(batch, Position, camera);
     m_velocity.X = m_velocity.Y = 0;
 }
Пример #4
0
 public void Draw(SpriteBatch batch, StageCamera camera)
 {
     m_texture.Draw(batch,
                    camera.ToCameraPosition(new Vector2(m_bounds.X, m_bounds.Y)),
                    0);
 }
Пример #5
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            LoadContent();

            // Set all the wall and floor tiles
            m_tiles = new Tile[40, 40];
            for (int y = 0; y < 40; y++) {
                for (int x = 0; x < 40; x++) {
                    int width = m_content.TileWidth;
                    int height = m_content.TileHeight;
                    int x_pos = x * m_content.TileWidth;
                    int y_pos = y * m_content.TileHeight;
                    int random = rand.Next(10) + 1;
                    if (random != 10) {
                        m_tiles[x, y] = new Tile(
                            m_content.GroundSprite,
                            new Rectangle(x_pos, y_pos, width, height),
                            false);
                    }
                    else {
                        m_tiles[x, y] = new Tile(
                            m_content.WallSprite,
                            new Rectangle(x_pos, y_pos, width, height),
                            true);
                    }
                }
            }

            // Initialize the camera
            m_camera = new StageCamera(StageWidth, StageHeight, Global.screenWidth, Global.screenHeight);
            m_camera.FollowEntity(m_player);

            base.Initialize();
        }