예제 #1
0
 public AnimationUpdater(Game1 game)
     : base(game)
 {
     slashAtkTexture = new AnimatedTexture(Vector2.Zero, 0, 0, 0);
     slashAtkTexture.Load(Game.Content, "slash attack ani", 7, 30);
     slashAtkTexture.Stop();
     // TODO: Construct any child components here
 }
예제 #2
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public bool UpdateAni(AnimatedTexture aniTx, float elapsed)
        {
            // TODO: Add your update code here
            aniTx.UpdateFrame(elapsed);

            if (aniTx.Frame / (aniTx.framecount - 1) == 1)
            {
                aniTx.Stop();
                return(false);
            }
            return(true);
            //base.Update(gameTime);
        }
예제 #3
0
        public void SubScrnClick(GameTime gameTime)
        {
            SoundEffect[] fxArr = SoundUpdater.fxList;

            currentCursor = custCursorDown;
            if (newMState != oldMState)
            {
                //gender selection screen - check for click on male (string M) or female (string F)
                if (Game1.chooseGender)
                {
                    if (newMState.Y >= 360 && newMState.Y <= 360 + localFont.MeasureString(Game1.M).Y)
                    {
                        if (newMState.X >= 280 && newMState.X <= 280 + localFont.MeasureString(Game1.M).X)
                        {
                            myGame.player.gender = Game1.M;
                            Game1.messageGender  = "Young Norseman";

                            //newGame = false;
                            Game1.chooseGender = false;
                            Game1.chooseClass  = true;
                        }
                        else if (newMState.X >= 330 && newMState.X <= 330 + localFont.MeasureString(Game1.F).X)
                        {
                            myGame.player.gender = Game1.F;
                            Game1.messageGender  = "Fair Norsemaiden";

                            //newGame = false;
                            Game1.chooseGender = false;
                            Game1.chooseClass  = true;
                        }

                        myGame.messageString = "Voices from a higher plane speak unto you: \n" +
                                               Game1.messageGender + ", peace hath prevailed in Valhalla since the destruction\n " +
                                               "of the physical realms: Ragnarok. But we grow weary of the calm, and\n " +
                                               "so, hath wound back the hands of time to restore that which was.\n" +
                                               "We must ask now for proof, through the justness of thine actions,\n" +
                                               "that the realm of Midgard be worth saving. (Press any key to continue)";
                    }
                }


                else if (Game1.chooseClass) //left-click on the class select screen
                {
                    Random r = new Random();

                    Player plrBase = myGame.player;

                    Weapon startWep      = null; //player's starting weapon
                    bool   isStWepRanged = false;

                    Armor startAmr = null;

                    Vector2 sPos  = plrBase.startingPos;
                    string  pName = myGame.enteredKeys;
                    string  pGen  = plrBase.gender;

                    string classN = null, wepN = null, amrN = null, aniTxName = null,
                           txName = null;
                    int wAtk = 0, wDef = 0, wToHit = 0, wWeight = 0,
                        amrDef = 0, amrWgt = 0,
                        aniFrameCount = 0, aniFPS = 0;

                    Texture2D wepTx = null, amrTx = null;

                    //int noOfArrows = 0;


                    AnimatedTexture pSprite = myGame.animTest;


                    //check for click on the top row of classes
                    if (newMState.Y >= 160 && newMState.Y <= 300)
                    {
                        if (newMState.X >= 50 && newMState.X <= 250)
                        {
                            classN = "Viking";
                            wepN   = "battle-axe";

                            wepTx         = Game.Content.Load <Texture2D>(wepN);
                            txName        = "viking";
                            aniTxName     = "viking ani";
                            aniFrameCount = 6;
                            aniFPS        = 3;
                            amrN          = "chain mail";
                            amrTx         = Game.Content.Load <Texture2D>("hide cuirass");
                            amrDef        = 3; amrWgt = 7;

                            wAtk              = 5; wDef = 0; wToHit = 4; wWeight = 9;
                            Game1.newGame     = false;
                            Game1.chooseClass = false;

                            //plr = Game1.player;
                        }
                        else if (newMState.X >= 275 && newMState.X <= 475)
                        {
                            //plr.cClass = "alchemist";
                            classN = "Medicine ";
                            wepN   = "leister";
                            wepTx  = Game.Content.Load <Texture2D>(wepN);
                            amrN   = "hide cuirass";
                            amrTx  = Game.Content.Load <Texture2D>(amrN);
                            //armor = new Armor("hide cuirass", r.Next(0, 3), 2, false, 6);

                            wAtk   = 3; wDef = 1; wToHit = 8; wWeight = 4;
                            amrDef = 1; amrWgt = 4;

                            aniFrameCount = 8;
                            aniFPS        = 4;
                            if (plrBase.gender == "Male")
                            {
                                classN   += "Man";
                                txName    = "alchemist";//("alchemist");
                                aniTxName = "alchemist frames";
                            }
                            else
                            {
                                classN   += "Woman";
                                txName    = "femalchemist";//("alchemist");
                                aniTxName = "femalchemist frames";
                            }
                            Game1.newGame     = false;
                            Game1.chooseClass = false;
                            //plr = Game1.player;
                        }
                        else if (newMState.X > 475)
                        {
                            classN        = "Survivalist";
                            wepN          = "long bow";
                            isStWepRanged = true;

                            amrN   = "hide cuirass";
                            amrDef = 1; amrWgt = 4;

                            amrTx = Game.Content.Load <Texture2D>(amrN);
                            wepTx = Game.Content.Load <Texture2D>(wepN);

                            //noOfArrows = r.Next(10, 21);

                            if (plrBase.gender == "Male")
                            {
                                aniTxName     = "survivalist ani";
                                aniFrameCount = 3;
                                aniFPS        = 3;
                            }
                            else
                            {
                                aniTxName     = "survivalist f";
                                aniFrameCount = 2;
                                aniFPS        = 1;
                            }
                            txName = "survivalist";


                            wAtk              = 1; wDef = 0; wToHit = 5; wWeight = 5;
                            Game1.newGame     = false;
                            Game1.chooseClass = false;
                        }
                        if (classN != null)
                        {
                            if (isStWepRanged)
                            {
                                startWep = new RangedWep(wepTx, wepN, r.Next(0, 2),
                                                         wAtk, wDef, false, wWeight, wToHit, new Weapon(Item.arrowTx, "arrow", 3, 4, 1, 7));
                            }
                            else
                            {
                                startWep = new Weapon(wepTx, wepN, r.Next(0, 2),
                                                      wAtk, wDef, false, wWeight, wToHit);
                            }

                            startAmr = new Armor(amrTx, amrN, r.Next(0, 2), amrDef, false, amrWgt);
                            /*Game1.player*/
                            plr = new Player(Game.Content.Load <Texture2D>(txName), classN,
                                             sPos, pName, pGen, startWep, startAmr);
                            plr.curTile  = Game1.visibleTilesArray[3, 3];
                            plr.skeleton = Game.Content.Load <Texture2D>("tombstone");
                            pSprite.Load(Game.Content, aniTxName, aniFrameCount, aniFPS);
                            Game1.newGame     = false;
                            Game1.chooseClass = false;
                            myGame.player     = plr;
                        }
                    }
                }
            }
            if (oldMState.LeftButton == ButtonState.Released)
            {
                Game1.sndUpdater.UpdateSound(fxArr[(int)SoundUpdater.EffectsIDs.clickFX]);
            }
            oldMState = newMState;

            base.Update(gameTime);
        }