コード例 #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(TextureLibrary.GetTexture(textureId), new Rectangle(0, 0, 800, 480), Color.White);

            if (isFading)
            {
                if (textFade - fadeSpeed <= 0)
                {
                    textFade = 0;
                    isFading = false;
                }
                else
                {
                    textFade -= fadeSpeed;
                }
            }
            else
            {
                if (textFade + fadeSpeed >= 255)
                {
                    textFade = 255;
                    isFading = true;
                }
                else
                {
                    textFade += fadeSpeed;
                }
            }

            spriteBatch.DrawString(TextureLibrary.GetFont(FONT_ID.TAPTOGO), "Tap to continue.", tapToGoPosition, new Color(0, 0, 0, (byte)textFade));
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: ElliotSeger/Caro-s-Quest
 public Player()
 {
     texture   = TextureLibrary.GetTexture("Player");
     speed     = 600;
     rectangle = texture.Bounds;
     inventory = new Inventory();
 }
コード例 #3
0
 public Missile(Vector2 aDirection, Vector2 aPosition, float aDamage, float aSpeed, GameObject aShooter) :
     base(TextureLibrary.GetTexture("Missile"), new Rectangle(aPosition.ToPoint(), new Point(100, 100)))
 {
     myDirection = aDirection;
     myDamage    = aDamage;
     myShooter   = aShooter;
     mySpeed     = aSpeed;
     myTarget    = (BaseEnemy)Game1.myObjects.Where(x => x is BaseEnemy).FirstOrDefault();
 }
コード例 #4
0
ファイル: Bullet.cs プロジェクト: ElliotSeger/PRR02_shootemup
 public Bullet(Vector2 aDirection, Vector2 aPosition, float aDamage, float aSpeed, GameObject aShooter) :
     base(TextureLibrary.GetTexture("Bullet"), new Rectangle(aPosition.ToPoint(), new Point(25, 25)))
 {
     myDirection = aDirection;
     myDamage    = aDamage;
     myShooter   = aShooter;
     mySpeed     = aSpeed;
     mySound     = SoundLibrary.GetSound("Shoot");
 }
コード例 #5
0
        private void RenderSprite(Sprite sprite, Camera camera)
        {
            textureLibrary.GetTexture(sprite.Texture).Use();
            textureLibrary.GetPrimitive(sprite.Texture).Use();

            var model = Matrix4.Identity;

            model *= Matrix4.CreateRotationZ(sprite.Angle);
            model *= Matrix4.CreateTranslation(sprite.Position);

            shader.SetMatrix4("model", model);
            shader.SetMatrix4("view", camera.GetViewMatrix());
            shader.SetMatrix4("projection", camera.GetProjectionMatrix());

            GL.DrawElements(PrimitiveType.Triangles, textureLibrary.IndicesLength,
                            DrawElementsType.UnsignedInt, 0);

            GL.BindTexture(TextureTarget.Texture2D, 0);
            GL.BindVertexArray(0);
        }
コード例 #6
0
        /// <summary>
        /// Called every draw loop from the GameEngine.
        /// </summary>
        /// <param name="spriteBatch"></param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.MAP_0), new Vector2(0, 0), Color.White);

            if (selectedTile.X >= 0 && selectedTile.Y >= 0)
            {
                spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.TILE_SELCT), new Vector2(selectedTile.X * TileDimensions.X, selectedTile.Y * TileDimensions.Y), Color.White);
            }

            // Draw all creeps.
            foreach (Creep c in creeps)
            {
                if (0 != c.Rotation)
                {
                    spriteBatch.Draw(TextureLibrary.GetTexture(c.TextureID), new Vector2(c.Position.X + (int)c.GetStat(CreepStats.Width) / 2, c.Position.Y + (int)c.GetStat(CreepStats.Height) / 2), new Rectangle(0, 0, c.GetStat(CreepStats.Width), c.GetStat(CreepStats.Height)), Color.White, Calculator.ToRadians(c.Rotation), new Vector2(c.GetStat(CreepStats.Width) / 2, c.GetStat(CreepStats.Height) / 2), 1, SpriteEffects.None, 0);
                }
                else
                {
                    spriteBatch.Draw(TextureLibrary.GetTexture(c.TextureID), c.Position, Color.White);
                }
            }

            foreach (Tower t in towers.Values)
            {
                spriteBatch.Draw(TextureLibrary.GetTexture(t.TextureID), t.Position, new Rectangle((t.Level <= 4 ? t.Level : 4) * (int)TileDimensions.X, 0, (int)TileDimensions.X, (int)TileDimensions.Y), Color.White);
            }

            foreach (Projectile p in projectileManager.Projectiles)
            {
                if (0 != p.Rotation)
                {
                    spriteBatch.Draw(TextureLibrary.GetTexture(p.TextureID),
                                     new Vector2(p.Position.X + (int)ProjectileDefinitions.ProjectileStats[p.type].Width / 2, p.Position.Y + (int)ProjectileDefinitions.ProjectileStats[p.type].Height / 2),
                                     new Rectangle(0, 0, ProjectileDefinitions.ProjectileStats[p.type].Width + 12, ProjectileDefinitions.ProjectileStats[p.type].Height + 12),
                                     Color.White,
                                     Calculator.ToRadians(p.Rotation),
                                     new Vector2(ProjectileDefinitions.ProjectileStats[p.type].Width / 2, ProjectileDefinitions.ProjectileStats[p.type].Height / 2),
                                     1,
                                     SpriteEffects.None, 0);
                }
                else
                {
                    spriteBatch.Draw(TextureLibrary.GetTexture(p.TextureID), p.Position, p.AnimationSource, Color.White);
                }
            }

            spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.MENU_TOP), new Rectangle(0, 0, 800, 20), Color.White);
            spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.MENU_LEFT), new Rectangle(0, 0, 144, 480), Color.White);

            SpriteFont font = TextureLibrary.GetFont(FONT_ID.HUDINFO);

            spriteBatch.DrawString(font, "Level: " + (1 + waveManager.BonusWave), new Vector2(125, 0), Color.LightGreen);
            spriteBatch.DrawString(font, "Cash: " + CurrentPlayer.Moneys, new Vector2(250, 0), Color.LightGreen);
            spriteBatch.DrawString(font, "Lives: " + CurrentPlayer.Lives, new Vector2(375, 0), Color.LightGreen);
            spriteBatch.DrawString(font, "Score: " + CurrentPlayer.Score, new Vector2(500, 0), Color.LightGreen);

            if (towers.ContainsKey(selectedTile))
            {
                spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.UPGRADE), new Rectangle(5, 20, 94, 90), Color.White);
                DrawUpgradeStuff(spriteBatch);
            }
            else
            {
                spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.TEACHER), new Rectangle(5, 20, 94, 90), Color.White);
                spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.LAWYER), new Rectangle(5, 120, 94, 90), Color.White);
                spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.JUDGE), new Rectangle(5, 220, 94, 90), Color.White);
            }
        }
コード例 #7
0
 public Sword(Point position)
 {
     texture   = TextureLibrary.GetTexture("Sword");
     rectangle = new Rectangle(position, new Point(100, 10));
 }
コード例 #8
0
 public EnemyShipBeta(Point aPosition) :
     base(TextureLibrary.GetTexture("EnemyShip"), new Rectangle(aPosition.X, aPosition.Y, 64, 48), 30, 75)
 {
     AccessSpeed = 150;
 }
コード例 #9
0
 public HealthPotion(Point position)
 {
     texture   = TextureLibrary.GetTexture("HealthPotion");
     rectangle = new Rectangle(position, new Point(50, 50));
 }
コード例 #10
0
 public EnemyBossMinion(Point aPosition) :
     base(TextureLibrary.GetTexture("EnemyMinion"), new Rectangle(aPosition.X, aPosition.Y, 40, 30), 20, 10)
 {
     AccessSpeed = 400;
     mySound     = SoundLibrary.GetSound("Bee");
 }
コード例 #11
0
 public EnemyShipAlpha(Point aPosition) :
     base(TextureLibrary.GetTexture("EnemyShip"), new Rectangle(aPosition.X, aPosition.Y, 64, 48), 40, 100)
 {
     AccessSpeed = 200;
 }
コード例 #12
0
 public MagicPotion(Point position)
 {
     texture = TextureLibrary.GetTexture("MagicPotion");
 }
コード例 #13
0
 public GoldCoin(Point aPosition) :
     base(TextureLibrary.GetTexture("Coin"), new Rectangle(aPosition.X, aPosition.Y, 40, 40))
 {
 }
コード例 #14
0
 public PlatinumCoin(Point aPosition) :
     base(TextureLibrary.GetTexture("UltraCoin"), new Rectangle(aPosition.X, aPosition.Y, 40, 40))
 {
 }
コード例 #15
0
 public HealthPowerUp(Point aPosition) :
     base(TextureLibrary.GetTexture("HealthPowerUp"), new Rectangle(aPosition.X, aPosition.Y, 100, 100))
 {
 }
コード例 #16
0
 public EnemyBoss2(Point aPosition) :
     base(TextureLibrary.GetTexture("EnemyShip"), new Rectangle(aPosition.X, aPosition.Y, 128, 96), 250, 1000)
 {
     AccessSpeed = 100;
 }
コード例 #17
0
 public EnemyCargoShip(Point aPosition) :
     base(TextureLibrary.GetTexture("EnemyCargo"), new Rectangle(aPosition.X, aPosition.Y, 64, 48), 50, 300)
 {
     AccessSpeed        = 200;
     myPreviousPosition = AccessPosition;
 }
コード例 #18
0
ファイル: Player.cs プロジェクト: ElliotSeger/PRR02_shootemup
 public Player() :
     base(TextureLibrary.GetTexture("Ship"), new Rectangle(750, 750, 100, 100), myMaxHealth)
 {
     AccessSpeed = 350;
 }