コード例 #1
0
        public Enemy3(Texture enemyTexture)
        {
            Dimensions.X = 255 * 0.3f * WindowProperties.ScaleX;
            Dimensions.Y = 255 * 0.3f * WindowProperties.ScaleY;

            for (var i = 0; i < 6; i++)
            {
                var enemyFrame = new Sprite(enemyTexture)
                {
                    Origin = new Vector2f(127.5f, 195.0f),
                    Scale  = new Vector2f(0.3f * WindowProperties.ScaleX,
                                          0.3f * WindowProperties.ScaleY),
                    Position    = RandomHorizontalPosition(),
                    TextureRect = new IntRect(i * 255, 0, 255, 390)
                };

                EnemyFrames.Add(enemyFrame);
            }

            HpBar = new HpBar(Dimensions);

            cannons = new Cannons(Position, Dimensions);

            HpMax = 12;
            Hp    = HpMax;
        }
コード例 #2
0
ファイル: Enemy1.cs プロジェクト: KMielnik/ASTROMARINES
        public Enemy1(Texture enemyTexture)
        {
            Dimensions.X = 255 * 0.3f * WindowProperties.ScaleX;
            Dimensions.Y = 255 * 0.3f * WindowProperties.ScaleY;

            for (var i = 0; i < 6; i++)
            {
                var enemyFrame = new Sprite(enemyTexture)
                {
                    Origin = new Vector2f(127.5f, 127.5f),
                    Scale  = new Vector2f(0.3f * WindowProperties.ScaleX,
                                          0.3f * WindowProperties.ScaleY),
                    Position = new Vector2f(WindowProperties.WindowWidth / 2,
                                            WindowProperties.WindowHeight / 2),
                    TextureRect = new IntRect(i * 255, 0, 255, 255)
                };

                EnemyFrames.Add(enemyFrame);
            }

            DecideStartingPostition();

            HpMax = 1;
            Hp    = HpMax;
        }