Inheritance: GraphicsResource
Example #1
1
        public Human(Game game, SpriteBatch screenSpriteBatch,
            PlayerSide playerSide)
            : base(game, screenSpriteBatch)
        {
            string idleTextureName = "";
            this.playerSide = playerSide;

            if (playerSide == PlayerSide.Left)
            {
                catapultPosition = new Vector2(140, 332);
                idleTextureName = "Textures/Catapults/Blue/blueIdle/blueIdle";
            }
            else
            {
                catapultPosition = new Vector2(600, 332);
                spriteEffect = SpriteEffects.FlipHorizontally;
                idleTextureName = "Textures/Catapults/Red/redIdle/redIdle";
            }

            Catapult = new Catapult(game, screenSpriteBatch,
                                    idleTextureName, catapultPosition,
                                    spriteEffect,
                                    playerSide == PlayerSide.Left
                                        ? false : true, true);
        }
Example #2
1
 public void Draw(SpriteBatch spriteBatch)
 {
     if (active)
         {
             pickupAnimation.Draw(spriteBatch);
         }
 }
 public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (sprite != null && visible)
     {
         spriteBatch.Draw(sprite, position, null, Color.White, 0, Vector2.Zero, new Vector2(1, spriteScale), SpriteEffects.None, 0);
     }
 }
Example #4
1
 public static void RenderPolygone(SpriteBatch spriteBatch, Texture2D texture, Polygon polygon, int lineThickness, Color color)
 {
     for (int i = 0; i < polygon.Points.Count; ++i)
     {
         RenderLine(spriteBatch, texture, polygon.Points[i], polygon.Edges[i], 1, lineThickness, color);
     }
 }
Example #5
1
        public virtual void Draw(SpriteBatch spriteBatch)
        {
            float left = Position.X + (EdgeTexture.Height / 2.0f);
            float top = Position.Y + (EdgeTexture.Height / 2.0f);
            float right = left + Dimensions.X - EdgeTexture.Height;
            float bottom = top + Dimensions.Y - EdgeTexture.Height;

            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(left, top), new Vector2(right, top), 1.0f, EdgeTint, RenderDepth);
            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(left, top), new Vector2(left, bottom), 1.0f, EdgeTint, RenderDepth);
            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(left, bottom), new Vector2(right, bottom), 1.0f, EdgeTint, RenderDepth);
            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(right, top), new Vector2(right, bottom), 1.0f, EdgeTint, RenderDepth);

            if (CornerTexture != null)
            {
                spriteBatch.Draw(CornerTexture, new Vector2(left, top), null, EdgeTint, 0.0f, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
                spriteBatch.Draw(CornerTexture, new Vector2(right, top), null, EdgeTint, MathHelper.PiOver2, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
                spriteBatch.Draw(CornerTexture, new Vector2(right, bottom), null, EdgeTint, MathHelper.Pi, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
                spriteBatch.Draw(CornerTexture, new Vector2(left, bottom), null, EdgeTint, MathHelper.Pi * 1.5f, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
            }

            if (BackgroundTexture != null)
            {
                Rectangle area = new Rectangle((int)left, (int)top, (int)(right - left),(int)(bottom - top));
                spriteBatch.Draw(BackgroundTexture, area, null, BackgroundTint, 0.0f, Vector2.Zero, SpriteEffects.None, RenderDepth + 0.005f);
            }
        }
Example #6
1
        public void Render(SpriteBatch spriteBatch)
        {
            SmoothScroll();

            int xLoop = (int)(drawArea.Width / tileSize.X);
            if (xLoop >= tiles.Length) xLoop = tiles.Length;

            for (int x = 0; x < xLoop; x++)
            {
                int yLoop = (int)(drawArea.Height / tileSize.Y);
                if (yLoop >= tiles[x].Length) yLoop = tiles[x].Length;

                for (int y = 0; y < yLoop; y++)
                {
                    float xpos = ((x * tileSize.X) + drawOffset.X) + drawArea.X;
                    float ypos = ((y * tileSize.Y) + drawOffset.Y) + drawArea.Y;

                    if (tileOffset.X < 0) tileOffset.X = 0;
                    if (tileOffset.Y < 0) tileOffset.Y = 0;
                    if ((tileOffset.Y + y) >= tiles[x].Length) tileOffset.Y = MaxOffset('Y', x);
                    if ((tileOffset.X + x) >= tiles.Length) tileOffset.X = MaxOffset('X', 0);

                    tiles[x + tileOffset.X][y + tileOffset.Y].Prepare(new Vector2(xpos, ypos), false);
                    tiles[x + tileOffset.X][y + tileOffset.Y].Render(spriteBatch);
                }
            }
        }
        public void DrawFlagScore(SpriteBatch spriteBatch, GameTime gameTime, float stoppingHeight)
        {
            scoreOrigin = ScoreFont.MeasureString(scoreText) / GameValues.ScoreSpriteScoreOriginOffset;

            spriteBatch.DrawString(ScoreFont, scoreText, new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreYOffset), Color.White, 0, scoreOrigin, 0.4f, SpriteEffects.None, 0f);

            if (Position.Y > stoppingHeight)
            {
                Position = new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreDropOffet);
            }
            else if (Position.Y <= stoppingHeight)
            {
                //Position.Y = stoppingHeight;
                Position = new Vector2(Position.X, stoppingHeight);
                if (scoreBuffer <= 0)
                {
                    scoreBuffer = GameValues.ScoreSpriteScoreBuffer;
                    ScoringOn = !ScoringOn;
                }
                else
                {
                    scoreBuffer--;
                }
            }
        }
Example #8
1
 public void debugDraw(SpriteBatch spritebatch, Texture2D texture)
 {
     foreach (Node nod in nodes){
         Vector2 adjustedPos = new Vector2(nod.Position.X - texture.Width/2, nod.Position.Y - texture.Height/2);
         spritebatch.Draw (texture, adjustedPos, Color.White);
     }
 }
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            foreach (Bullet bullet in bulletList)
                bullet.Draw(spriteBatch);
        }
Example #10
1
 public void Draw(SpriteBatch spriteBatch)
 {
     foreach (Item item in itemList)
     {
         item.Draw(spriteBatch);
     }
 }
Example #11
1
 public virtual void draw(TileDrawInfo drawInfo, SpriteBatch spriteBatch)
 {
     switch (drawInfo.tilePart)
     {
         case TilePart.STRUCTURE:
             foreach (Drawable structure in structures)
             {
                 adjustedDepthDraw(structure, drawInfo, spriteBatch);
             }
             break;
         case TilePart.SURFACE:
             if (surface == null)
             {
                 break;
             }
             adjustedDepthDraw(surface, drawInfo, spriteBatch);
             break;
         case TilePart.LEFTFACE:
             if (leftFace == null)
             {
                 break;
             }
             adjustedDepthDraw(leftFace, drawInfo, spriteBatch);
             break;
         case TilePart.RIGHTFACE:
             if (rightFace == null)
             {
                 break;
             }
             adjustedDepthDraw(rightFace, drawInfo, spriteBatch);
             break;
     }
 }
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
     dungeonMap.Draw(spriteBatch);
     player.MapDraw(spriteBatch);
     spriteBatch.End();
 }
Example #13
1
 public void AllDraw(SpriteBatch spriteBatch)
 {
     for (int i = 0; i < Backgrounds.Count; i++)
     {
         Backgrounds[i].Draw(spriteBatch);
     }
 }
 public RenderingExplosion(ContentManager Content)
     : base(Content)
 {
     spriteBatch = Content.ServiceProvider.GetService(typeof(SpriteBatch)) as SpriteBatch;
     explosionTexture = Content.Load<Texture2D>("TroopTexture/explosion");
     stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame;
 }
 public void Draw(SpriteBatch spriteBatch)
 {
     if (this.tupianwenzi.IsShowing)
     {
         this.tupianwenzi.Draw(spriteBatch);
     }
 }
 public override void Draw(SpriteBatch spriteBatch)
 {
     base.Draw(spriteBatch);
     Site.Draw(spriteBatch);
     if (MyProjectile != null && MyProjectile.ProjectileState != Projectile.PROJECTILE_STATE.STILL)
             MyProjectile.Draw(spriteBatch);
 }
Example #17
1
 public override void Draw(SpriteBatch sprite)
 {
     if (Config.statusGry != GameState.menu)
     {
         while (pozycja.X < Config.rozmiarPlanszy.X)
         {
             pozycja.Y = 0;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.Y = Config.rozmiarPlanszy.Y;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.X += teksturaPodstawowa.Width + 20;
         }
         pozycja = new Vector2(0, 0);
         while (pozycja.Y < Config.rozmiarPlanszy.Y)
         {
             pozycja.X = 0;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.X = Config.rozmiarPlanszy.X;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.Y += teksturaPodstawowa.Height + 20;
         }
         pozycja = new Vector2(0, 0);
     }
 }
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 position, SpriteEffects spriteEffects)
        {
            if (Animation == null)
            {
                throw new NotSupportedException("No animation is currently playing.");
            }

            time += (float)gameTime.ElapsedGameTime.TotalSeconds;
            while (time > Animation.frameTime)
            {
                time -= Animation.frameTime;

                if (Animation.isLooping)
                {
                    frameIndex = (frameIndex + 1) % Animation.FrameCount;

                }
                else
                {
                    frameIndex = Math.Min(frameIndex + 1, Animation.FrameCount - 1);
                }
            }

            Rectangle source = new Rectangle(FrameIndex * Animation.FrameWidth, 0, Animation.FrameWidth, Animation.FrameHeight);

            spriteBatch.Draw(animation.texture, position, source, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f);
        }
Example #19
1
 public C_Maps()
 {
     //init stuff here
     m_mousePosition = Vector2.Zero;
     m_font1 = null;
     m_spriteBatch = null;
 }
 public void Draw(SpriteBatch spriteBatch)
 {
     foreach (Creep c in creepWave)
     {
         c.Draw(spriteBatch);
     }
 }
        public override void DrawObjects(GraphicsDevice graphicDevice, SpriteBatch spriteBatch, ContentManager content)
        {
            graphicDevice.Clear(Color.CornflowerBlue);
            SpriteFont newFont = content.Load<SpriteFont>(@"Fonts/Text");

            spriteBatch.Begin();

            this.controlScreenBackgroundPosition = new Vector2(0, 0);
            spriteBatch.Draw(this.controlScreenBackgroundTexture, this.controlScreenBackgroundPosition, Color.White);

            if (this.controlScreenItems.Count < 1)
            {
                // Back planket and text;
                this.buttonPosition = new Vector2(840, 660);
                this.controlScreenItems.Add(new MenuItems(this.button, this.buttonPosition, "Back", newFont, false));
            }

            this.controlScreenItems[this.selectedEntry].Selected = true;
            foreach (var item in this.controlScreenItems)
            {
                item.DrawMenuItems(spriteBatch, new Color(248, 218, 127));
            }

            this.DrawCursor(spriteBatch);
            spriteBatch.End();
        }
Example #22
1
 public void draw(SpriteBatch spriteBatch)
 {
     foreach (Laser baseProjectile in m_LaserArray)
     {
         baseProjectile.draw(spriteBatch);
     }
 }
Example #23
1
        public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            Vector2 _position2 = new Vector2(_position.X, _position.Y + 150);
            Vector2 _position3 = new Vector2(_position.X, _position.Y + 300);

            if (pause)
            {
                spriteBatch.Draw(_texture, Vector2.Zero, Color.White);

                if (jouerIn)
                    spriteBatch.Draw(jouer, _position, Color.Blue);
                else
                    spriteBatch.Draw(jouer, _position, Color.White);

                if (OptionIn)
                    spriteBatch.Draw(options, _position2, Color.Blue);
                else
                    spriteBatch.Draw(options, _position2, Color.White);

                if (QuitterIn)
                    spriteBatch.Draw(quitter, _position3, Color.Blue);
                else
                    spriteBatch.Draw(quitter, _position3, Color.White);

            }
        }
Example #24
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);
     sounds.Add(new SoundPlayer(@"./Content/Sound/s1.wav"));
     sounds.Add(new SoundPlayer(@"./Content/SampleBMS/1A#6.wav"));
 }
Example #25
0
 public void Draw(SpriteBatch spriteBatch)
 {
     foreach (Sprite star in stars)
     {
         star.Draw(spriteBatch);
     }
 }
        public void Draw(SpriteBatch spriteBatch)
        {
            var player = ((SceneMap)SceneManager.Instance.GetCurrentScene()).Player;

            // Draw the hearts
            for (var i = 0; i < player.HP; i++)
            {
                spriteBatch.Draw(TextureRegion.Texture,
                    _position + _hearthSpritePosition + (Vector2.UnitX * i * (_heartSprite.Width + 2)), _heartSprite, Color.White);
            }

            // Draw the lives
            for (var i = 0; i < player.Lives; i++)
            {
                spriteBatch.Draw(TextureRegion.Texture,
                    _position + _lifeSpritePosition + (Vector2.UnitX * i * (_lifeSprite.Width + 2)), _lifeSprite, Color.White);
            }

            // Draw the ammo
            spriteBatch.Draw(TextureRegion.Texture, _position + _gunSpritePosition, _gunSprite, Color.White);
            spriteBatch.DrawString(SceneManager.Instance.GameFont, player.Ammo.ToString(),
                _position + _gunSpritePosition + (Vector2.UnitX * (_gunSprite.Width + 2)), _ammoTextColor);

            // Draw the coins
            spriteBatch.Draw(TextureRegion.Texture, _coinsPosition, _coinSprite, Color.White);
            spriteBatch.DrawString(SceneManager.Instance.GameFont, player.Coins.ToString(), 
                _coinsPosition + new Vector2(_coinSprite.Width + 3, 1), _coinsTextColor);
        }
Example #27
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);

            // TODO: use this.Content to load your game content here
        }
Example #28
0
 public void Draw(SpriteBatch spriteBatch)
 {
     
     if (id == 0)               // if id if air then return
        return;
     spriteBatch.Draw(Sprite.sprite.tileSet,bound, tile[index],color,0.0f,Vector2.Zero,effect,0f);
 }
Example #29
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            map = new Map();
            map.Load(Content);
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(background, drawRect, Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
            GraphicsDevice g = spriteBatch.GraphicsDevice;
            Viewport defaultViewport = g.Viewport;
            Viewport drawViewport = defaultViewport;
            drawViewport.X = drawRect.X;
            drawViewport.Y = drawRect.Y;
            drawViewport.Width = drawRect.Width;
            drawViewport.Height = drawRect.Height;
            g.Viewport = drawViewport;

            GraphicsDevice graphics = spriteBatch.GraphicsDevice;
            graphics.DepthStencilState = DepthStencilState.Default;

            if (model != null)
            {
                model.Draw(camera, info);
            }
            g.Viewport = defaultViewport;
            if (isConflict)
            {
                spriteBatch.Draw(ngTexture, drawRect, Color.White);
            }
        }