Beispiel #1
0
        private AnimatedTexture wheelTexture; //Hamster wheel spins when Rufus gets on

        #endregion Fields

        #region Constructors

        public Bulb(Game g, Vector2 pos)
            : base(g)
        {
            illuminated = false;
            Position = pos;
            wheelTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth); //initalize tornado texture
        }
        private int yoyo = 0; //creates a yoyo effect for tornado movement

        #endregion Fields

        #region Constructors

        public Tornado(Game g, Vector2 pos)
            : base(g)
        {
            spritePosition = pos;//initial position
            destroyed = false;  //checks if the tornado still exists
            tornadoTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth); //initalize tornado texture
            yomax = r.Next(50, 300);
        }
        private Vector2 spritePosition; // The current x, y position of the sprite

        #endregion Fields

        #region Constructors

        ///
        /// Constructor
        ///
        public Character(Game g, Vector2 startingPos, String charName)
            : base(g)
        {
            spritePosition = startingPos;   // Initial position of the sprite

            // Description............................................
            this.level = (g as Game1).level;

            // Each subclass/child class/class derived from Character (Kim, Ron, Rufus)
            // specifies own name when object is constructed (in Game1.cs)
            // This name is used to generate the file paths for all images for the character!!
            characterName = charName;

            isFacingRight = true; // the sprite sheets are by default right-facing

            IsSelected = false; // default to false
                                // Kim child class overrides (she is initial starting character)

            // Initialize the array to contain the AnimatedTextures (different sprite animation loops)
            sprite = new AnimatedTexture[4];

            //------------### need to do this or not???
            // Just make sure these things are initialized, have to wait til loadcontent function
            // to actually make them right
            idleTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            runningTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            jumpingTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            specialMoveTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            //------------###

            // Set device frame rate to 30 fps.
            Game.TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);
        }
        private Vector2 spritePosition; // The current x, y position of the sprite

        #endregion Fields

        #region Constructors

        ///
        /// Constructor for the Character class
        ///
        public Character(Game g, Vector2 startingPos, String charName)
            : base(g)
        {
            // Description............................................
            this.level = (g as Game1).level;

            // Each subclass/child class/class derived from Character (Kim, Ron, Rufus)
            // specifies own name in its own constructor
            // (used to be Game1.cs, changed for further encapsulation)
            // This name is used to generate the file paths for all images for the character!!
            characterName = charName;

            spritePosition = startingPos;   // Initial position of the sprite in the game
            initialPosition = startingPos;  // Position that the character will return to if they die

            isFacingRight = true;   // the sprite sheets are by default right-facing

            IsSelected = false;     // default to false
                                    // Kim child class overrides (she is initial starting character)

            // Originally, these were private const member variables for animated sprites
            // since they don't get adjusted, just made them local variables
            //--- Member variables for animated sprites ---//
            float Rotation = 0;
            float Scale = 1.0f;
            float Depth = 0.5f;

            // Just make sure these things are initialized,
            // have to wait til loadcontent function to actually make them right
            idleTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            runningTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            jumpingTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            specialMoveTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);

            // Initialize the array to contain the AnimatedTextures (different sprite animation loops)
            sprite = new AnimatedTexture[4];

            // Set device frame rate to 30 fps.
            Game.TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);
        }