Beispiel #1
0
 public GameView(SpriteBatch spriteBatch, Texture2D texture, Camera camera)
 {
     this.spriteBatch = spriteBatch;
     this.texture = texture;
     this.cam = camera;
     //explosionSystem = new ExplosionSystem(modelStartPosition);
     explosion = new Explosion(modelStartPosition);
 }
Beispiel #2
0
        internal void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
        {
            Vector2 viewPosition = camera.GetVisualPositions(position);
            Vector2 explosionViewSize = camera.GetVisualPositions(explosionSize);

            Rectangle explosionRect = new Rectangle(frameX * size, frameY * size, size, size);
            Rectangle rect = new Rectangle((int)viewPosition.X, (int)viewPosition.Y, (int)explosionViewSize.X, (int)explosionViewSize.Y);

            spriteBatch.Draw(texture, rect, explosionRect, Color.White);
        }
Beispiel #3
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.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            texture = Content.Load<Texture2D>("explosion");

            cam = new Camera(400, 400);

            view = new GameView(spriteBatch, texture, cam);

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