Example #1
0
        public Aura(String s, Luigi l)
        {
            position = new Vector2(l.Body.X, l.Body.Y);
            imageIndex = 0;
            imageTime = 10f;
            imageSpeed = 1.4f;
            imageCount = 0f;
            offsetX = 0;
            offsetY = 0;

            srcRect = new Rectangle[8];
            if (s == "Fire")
            {
                srcRect[0] = new Rectangle(9, 580, 54, 26);
                srcRect[1] = new Rectangle(66, 542, 64, 64);
                srcRect[2] = new Rectangle(133, 505, 80, 101);
                srcRect[3] = new Rectangle(216, 504, 88, 99);
                srcRect[4] = new Rectangle(307, 504, 80, 102);
                srcRect[5] = new Rectangle(390, 510, 80, 96);
                srcRect[6] = new Rectangle(473, 527, 74, 79);
                srcRect[7] = new Rectangle(550, 553, 74, 53);
            }
            else if (s == "Star")
            {
                srcRect[0] = new Rectangle(7, 219, 54, 26);
                srcRect[1] = new Rectangle(64, 181, 64, 64);
                srcRect[2] = new Rectangle(131, 144, 80, 101);
                srcRect[3] = new Rectangle(214, 146, 88, 99);
                srcRect[4] = new Rectangle(305, 143, 80, 102);
                srcRect[5] = new Rectangle(388, 149, 80, 96);
                srcRect[6] = new Rectangle(471, 166, 74, 79);
                srcRect[7] = new Rectangle(548, 192, 74, 53);
            }
        }
Example #2
0
        public void Update(Luigi luigi, Level level)
        {
            center = new Vector2(MathHelper.Clamp(luigi.Body.X + 6, viewport.Width / 4, level.XSize * 24 - viewport.Width / 4),
                MathHelper.Clamp(luigi.Body.Y + 16, level.YSize * -24 + viewport.Height / 4, -viewport.Height / 4));

            transform = Matrix.CreateTranslation(new Vector3(-center.X, -center.Y, 0)) *
                                                Matrix.CreateRotationZ(0) *
                                                Matrix.CreateScale(new Vector3(zoom, zoom, 0)) *
                                                Matrix.CreateTranslation(new Vector3(viewport.Width / 2, viewport.Height / 2, 0));
        }
Example #3
0
        public void draw(SpriteBatch spritebatch, Luigi luigi,Viewport v)
        {
            spritebatch.Begin();

            spritebatch.DrawString(Game1.font1, "coins X " + luigi.Coins, new Vector2(v.Width - 135 - ((luigi.Coins.ToString().Length) * 16) + 1, 6), Color.DarkGoldenrod, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
            spritebatch.DrawString(Game1.font1, "coins X " + luigi.Coins, new Vector2(v.Width - 135 - ((luigi.Coins.ToString().Length) * 16), 5), Color.Gold, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);

            spritebatch.DrawString(Game1.font1, "hp X ", new Vector2(6, 6), Color.DarkRed, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
            spritebatch.DrawString(Game1.font1, "hp X ", new Vector2(5, 5), Color.Red, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);

            for(int i = 0; i < luigi.Hp; i++)
            {
                spritebatch.Draw(Game1.sprLuigi, new Rectangle(70 + (i * 25), 5, 24, 24), new Rectangle(0, 0, 16, 16), Color.White);
            }

            spritebatch.End();
        }
Example #4
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (level == null)
                level = new LevelTest();
            if (camera == null)
                camera = new Camera(GraphicsDevice.Viewport);
            if (luigi == null)
                luigi = new Luigi(new Vector2(32, -100));
            if (hud == null)
                hud = new HUD();

            if (MediaPlayer.State == MediaState.Stopped)
            {
                MediaPlayer.Play(level.MainSong);
                MediaPlayer.IsRepeating = true;
            }

            k1 = Keyboard.GetState();
            g = GamePad.GetState(PlayerIndex.One);

            if (g.IsConnected)
                luigi.input(g);
            else
                luigi.input(k1);

            luigi.update(level);

            camera.Update(luigi, level);

            level.disposeBlocksandItems();
            level.update(luigi);

            base.Update(gameTime);
        }
Example #5
0
        public void update(Level l, Luigi luigi)
        {
            position = new Vector2(luigi.Body.X - srcRect[imageIndex].Width / 2 + luigi.Body.Width / 2, luigi.Body.Bottom - srcRect[imageIndex].Height + luigi.Body.Height / 6);

            animate();
        }