コード例 #1
0
 public Hero(Vector2f position, Window2D window2D, Level level)
 {
     elapsedBonusTime  = 0;
     weapon            = Weapons.Pistol;
     this.level        = level;
     HeroImage         = new Image("Sprites/Player/player_gun.png");
     Texture           = new Texture(HeroImage);
     TextureRect       = new IntRect(0, 0, 49, 43);
     Scale             = new Vector2f(1f, 1f);
     Origin            = new Vector2f(GetLocalBounds().Width / 2, GetLocalBounds().Height / 2);
     Position          = position;
     sight             = new Sight(window2D);
     window            = window2D;
     IsAlive           = true;
     timeSinceLastShot = 0f;
 }
コード例 #2
0
ファイル: Menu.cs プロジェクト: DipCoy/Tonight
        protected override void Initialize()
        {
            music      = new Music("sounds/MarcelKey.ogg");
            music.Loop = true;
            music.Play();

            var backgroundTexture = new Texture("images/mainMenu.png");

            background = new Sprite(backgroundTexture);

            var playButtonImage = new Image("images/playButton.png");

            playButtonImage.CreateMaskFromColor(Color.Black);
            var playButtonTexture = new Texture(playButtonImage);

            playButton = new Sprite(playButtonTexture);

            var exitButtonImage = new Image("images/exitButton.png");

            exitButtonImage.CreateMaskFromColor(Color.Black);
            var exitButtonTexture = new Texture(exitButtonImage);

            exitButton = new Sprite(exitButtonTexture);

            var houseLevelButtonImage = new Image("images/houseLevelButton.png");

            houseLevelButtonImage.CreateMaskFromColor(Color.Black);
            var houseLevelButtonTexture = new Texture(houseLevelButtonImage);

            houseLevelButton = new Sprite(houseLevelButtonTexture);

            var drugDenLevelButtonImage = new Image("images/drugDenLevelButton.png");

            drugDenLevelButtonImage.CreateMaskFromColor(Color.Black);
            var drugDenLevelButtonTexture = new Texture(drugDenLevelButtonImage);

            drugDenLevelButton = new Sprite(drugDenLevelButtonTexture);

            var hallwayLevelButtonImage = new Image("images/hallwayLevelButton.png");

            hallwayLevelButtonImage.CreateMaskFromColor(Color.Black);
            var hallwayLevelButtonTexture = new Texture(hallwayLevelButtonImage);

            hallwayLevelButton = new Sprite(hallwayLevelButtonTexture);

            var backButtonImage = new Image("images/backButton.png");

            backButtonImage.CreateMaskFromColor(Color.Black);
            var backButtonTexture = new Texture(backButtonImage);

            backButton = new Sprite(backButtonTexture);


            playButton.Origin =
                new Vector2f(playButton.GetLocalBounds().Width / 2, playButton.GetLocalBounds().Height / 2);
            playButton.Position = new Vector2f(970, 740);

            exitButton.Origin =
                new Vector2f(exitButton.GetLocalBounds().Width / 2, exitButton.GetLocalBounds().Height / 2);
            exitButton.Position = new Vector2f(970, 870);

            houseLevelButton.Origin = new Vector2f(houseLevelButton.GetLocalBounds().Width / 2,
                                                   houseLevelButton.GetLocalBounds().Height / 2);
            houseLevelButton.Position = new Vector2f(970, 590);

            drugDenLevelButton.Origin = new Vector2f(drugDenLevelButton.GetLocalBounds().Width / 2,
                                                     drugDenLevelButton.GetLocalBounds().Height / 2);
            drugDenLevelButton.Position = new Vector2f(970, 720);

            hallwayLevelButton.Origin = new Vector2f(hallwayLevelButton.GetLocalBounds().Width / 2,
                                                     hallwayLevelButton.GetLocalBounds().Height / 2);
            hallwayLevelButton.Position = new Vector2f(970, 850);

            backButton.Origin =
                new Vector2f(backButton.GetLocalBounds().Width / 2, backButton.GetLocalBounds().Height / 2);
            backButton.Position = new Vector2f(970, 980);

            originalButtonColor = playButton.Color;
            mouseColor          = new Color(232, 106, 23);
            selectedButton      = Buttons.None;
            menuType            = MenuType.Main;
            cursor = new Sight(window2D);
        }