Esempio n. 1
0
        //Chooses a random item, initializes it, and adds it to the item list
        public void AddRandomItem(Item.ItemState addItemState, Vector2 addItemLocation)
        {
            //Create new item and an item animation
            Item gameItem = new Item(ScreenManager.Game);
            Animation itemAnimation = new Animation();

            //Folder where textures are located in the project
            string textureFolder = "Textures/";

            //Name of the texture image
            string addItemString = "";

            int randChoice = Random.Next(1, 10);

            //Logic to choose a random item to spawn
            if (randChoice <= 5)
            {
                addItemString = textureFolder + "rocketship";
                gameItem.GameItemNumber = Item.ItemNumber.ItemOne;
            }

            else
            {
                addItemString = textureFolder + "spaceship";
                gameItem.GameItemNumber = Item.ItemNumber.ItemTwo;
            }

            gameItem.GameItemState = addItemState;

            ItemBatch.Add(gameItem);

            //Initialize the game item
            gameItem.Initialize(addItemString, addItemLocation);
        }
Esempio n. 2
0
        public void Initialize(string textureString, Vector2 itemPosition)
        {
            //Initialize starting position
            Position = itemPosition;

            //Initialize item's texture
            itemTexture = Game.Content.Load<Texture2D>(textureString);

            //Animation to be played for texture. This is a 1 frame "animation". Just in case we want an animation in the future.
            itemAnimation = new Animation();
            itemAnimation.Initialize(itemTexture, Position, 1, true, 200, 270, 160, 0.50f);

            //Initialize all position state flags to be false
            TrappedInCorner = false;
            IsDragged = false;
        }
Esempio n. 3
0
        //Initializes the implosion animation at the specified position
        public void AddImplosion(Vector2 implosionPosition)
        {
            Animation effectAnimation = new Animation();
            effectAnimation.Initialize(implosionTexture, implosionPosition, 12, false, 45, 134, 134, 1.0f);
            effectList.Add(effectAnimation);

            if (OptionsScreen.IsSoundOn())
                itemdrop.Play();
        }
Esempio n. 4
0
        //Intializes the explosion animation at the specified position
        public void AddExplosion(Vector2 explosionPosition)
        {
            Animation effectAnimation = new Animation();
            effectAnimation.Initialize(explosionTexture, explosionPosition, 12, false, 45, 134, 134, 12.0f);
            effectList.Add(effectAnimation);

            //If the sound option is on, play the explosion sound
            if (OptionsScreen.IsSoundOn())
            {
                AudioManager.PlaySound("Explosion");
            }
        }