public ParticleOverScreen(Texture2D newTexture, Vector2 newPosition, Vector2 newVelocity, Camera camera)
 {
     texture = newTexture;
     position = newPosition;
     velocity = newVelocity;
     this.camera = camera;
 }
示例#2
0
        public CollisionTiles(int i, Rectangle newRectangle, Camera camera) : base(camera)
        {
            texture = Content.Load<Texture2D>("Tiles" + i);
            //trees = Content.Load<Texture2D>("Tree" + i);

            Rectangle = newRectangle;
        }
        public void LoadContent(SpriteBatch spriteBatch, ContentManager Content, Viewport viewport, 
            Camera camera, Texture2D enemyTexture, GraphicsDeviceManager graphics, 
            SoundEffect _backgroundMusic, GameController _gameController, 
            SoundEffect _fireballSound, SpriteFont _spritefont, Texture2D _bossTexture)
        {
            _enemyTexture = enemyTexture;
            this.camera = camera;
            _graphics = graphics;

            spritefont = _spritefont;

            bossTexture = _bossTexture;

            backgroundMusic = _backgroundMusic;
            fireballSound = _fireballSound;

            _content = Content;
            gameController = _gameController;
            character = Content.Load<Texture2D>("imp");
            Flame.SetTexture(Content.Load<Texture2D>("Flames"));
            
            soundEffectInstance = backgroundMusic.CreateInstance();

            onFirstLevel = false;
            onSecondLevel = false;
            onThirdLevel = false;
            onFourthLevel = false;

        }
 public ParticleGenerator(Texture2D newTexture, float newSpawnWidth, float newDensity, Camera camera)
 {
     texture = newTexture;
     spawnWidth = newSpawnWidth;
     density = newDensity;
     random1 = new Random();
     random2 = new Random();
     this.camera = camera;
 }
        public void LoadContent(SpriteBatch spriteBatch, ContentManager Content, Viewport viewport,Texture2D Background, Texture2D Play,Texture2D InstructionButton)
        {
            instructionButton = InstructionButton;
            camera = new Camera(viewport);

            //sprites
            startMenuBackground = Background;
            playButton = Play;

            menuView = new MenuView(camera);
        }
示例#6
0
        public Flame(Vector2 position, Map map, Vector2 velocity, Camera camera, float range = 2f) : base(position, camera)
        {
            this.map = map;
            this.velocity = velocity;
            this.range = range;

            character = texture;

            offset = new Vector2(62 / 2, 76 / 2);

            FramesPerSecond = 9;
            AddAnimation(4, 0, 0, "fire", 62, 76);
            PlayAnimation("fire");
        }
示例#7
0
        public Enemy(Vector2 position, Map map, List<AnimatedSprites> animatedSprites, Camera camera, GraphicsDeviceManager graphics, Texture2D texture, Player _player) : base(position, camera)
        {
            this.map = map;
            hitbox = new Vector4(15, 40, 49, 66); // bästa raden gällande karaktären!
            this.animatedSprites = animatedSprites;
            life = 2;
            giveDamage = 5;
            //velocity = new Vector2(2,2);//speed later
            this.position = position;
            this.graphics = graphics;
            Radius = 13f;
            character = texture;

            player = _player;
            offset = new Vector2(hitbox.X + hitbox.Z, hitbox.Y + hitbox.W) / 2f;

            enemyWidth = character.Width;
            enemyHeight = character.Height;

            LoadContent();
            
        }
示例#8
0
        // The constructor of the Player class//
        public Player(Vector2 position, Map map, List<AnimatedSprites> animatedSprites, Camera camera, GameController _gameController, SoundEffect _fireballSound) : base(position, camera)//this position is handled through the base class
        {
            spreadRandom = new Random();
            life = 5;
            giveDamage = 1;
            this.position = position;
            this.camera = camera;
            this.map = map;
            this.animatedSprites = animatedSprites;

            fireballSound = _fireballSound;

            hitbox = new Vector4(15, 40, 49, 66); // bästa raden gällande karaktären!   (15, 40, 49, 66)
            offset = new Vector2(hitbox.X + hitbox.Z, hitbox.Y + hitbox.W) / 2f;
            gameController = _gameController;
            FramesPerSecond = 6;

            //Adds all the players animations
            AddAnimation(3, 1, 0, "Down", 64, 64);
            AddAnimation(3, 65, 0, "Left", 64, 64);
            AddAnimation(3, 129, 0, "Right", 64, 64);
            AddAnimation(3, 193, 0, "Up", 64, 64);
            PlayAnimation("Down");
        }
 public MenuView(Camera camera)
 {
     this.camera = camera;
 }
示例#10
0
 public Boss(Vector2 position, Map map, List<AnimatedSprites> animatedSprites, Camera camera, GraphicsDeviceManager graphics, Texture2D texture, Player _player) : base(position, map, animatedSprites, camera, graphics, texture, _player)
 {
     enemySpeed = 1.5f;
     life = 40;
     Radius = 30f;
 }
示例#11
0
 public Tiles(Camera camera)
 {
     this.camera = camera;
 }
示例#12
0
 public Map(Camera camera)
 {
     this.camera = camera;
 }
 public AnimatedSprites(Vector2 position, Camera camera)
 {
     this.position = position;
     this.camera = camera;
 }
        /// <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);

            
            //create all the necessary classes!
            menuController = new MenuController();
            gameController = new GameController(this);
            
            camera = new Camera(GraphicsDevice.Viewport);

            //snow = new ParticleGenerator(Content.Load<Texture2D>("Snowflake"), graphics.GraphicsDevice.Viewport.Width, 50, camera);
            rain = new ParticleGenerator(Content.Load<Texture2D>("Rain"), graphics.GraphicsDevice.Viewport.Width, 50, camera);

            backgroundMusic = Content.Load<SoundEffect>("sleeping_beast_4"); // ge cred ... //http://www.opsound.org/artist/dhalius/

            fireballSound = Content.Load<SoundEffect>("fireballShot");// när spelaren skjuter så kommer ljud!
            spritefont = Content.Load<SpriteFont>("NewSpriteFont");
            menuFont = Content.Load<SpriteFont>("SpriteFontMenu/NewSpriteFont");
            //Load all the textures here and sound as well!
            Texture2D enemyTexture = Content.Load<Texture2D>("Bat");
            Texture2D bossTexture = Content.Load<Texture2D>("Fox");
            Texture2D startMenuBackground = Content.Load<Texture2D>("KillerStory");
            Texture2D playButton = Content.Load<Texture2D>("playButton");
            Texture2D instructionButton = Content.Load<Texture2D>("InstructionsButton");
            //character = Content.Load<Texture2D>("Fox");

            soundEffectInstance = backgroundMusic.CreateInstance();

            //pause saker
            gameOverScreen = Content.Load<Texture2D>("GameOverScreen");
            gameOverRectangle = new Rectangle(0, 0, gameOverScreen.Width, gameOverScreen.Height);

            pauseTexture = Content.Load<Texture2D>("PauseMenu");
            pausedRectangle = new Rectangle(0, 0, pauseTexture.Width, pauseTexture.Height);

            FishishedScreen = Content.Load<Texture2D>("FinishedScreen");
            FishishedRectangle = new Rectangle(0, 0, FishishedScreen.Width, FishishedScreen.Height);

            pauseInstructions = Content.Load<Texture2D>("Instructions");
            pausedRectangleInstruction = new Rectangle(0, 0, pauseTexture.Width, pauseTexture.Height);

            buttonPlay = new PauseButton();
            buttonPlay.Load(Content.Load<Texture2D>("ResumeButton2"), new Vector2(400, 400));
            buttonQuit = new PauseButton();
            buttonQuit.Load(Content.Load<Texture2D>("QuitButton2"), new Vector2(400, 450));
            buttonMainMenu = new PauseButton();
            buttonMainMenu.Load(Content.Load<Texture2D>("MenuButton2"), new Vector2(400, 500));
            buttonInstruction = new PauseButton();
            buttonInstruction.Load(Content.Load<Texture2D>("InstructionsButton"), new Vector2(400, 550));
            buttonBack = new PauseButton();
            buttonBack.Load(Content.Load<Texture2D>("ButtonBack"), new Vector2(740, 780));
            
            //load all the classes and give them all the necessary parameters!
            menuController.LoadContent(spriteBatch, Content, GraphicsDevice.Viewport, startMenuBackground, playButton, instructionButton);
            gameController.LoadContent(spriteBatch, Content, GraphicsDevice.Viewport, camera, enemyTexture, graphics, backgroundMusic, gameController, fireballSound, spritefont, bossTexture);

            menuController.setPosition(new Vector2(400, 400));// sätter positionen för knappen!
        }