Пример #1
0
 public void Update(GameTime gameTime, ref ScreenManager Screenmanager, ref Mario mario)
 {
     Mariostate.UpdatePosition(gameTime, ref Screenmanager, ref mario);
     Mariostate.Update(gameTime);
     Bounds = new Rectangle((int)Mariostate.Position.X, (int)Mariostate.Position.Y, Mariostate.Width, Mariostate.Height);
     if (Mariostate.Vibrating == true)
     {
         TransformingTime += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
         if (TransformingTime >= 2000)
         {
             Mariostate.Vibrating = false;
             TransformingTime     = 0;
         }
     }
     if (Mariostate.GetType() == typeof(MarioFire))
     {
         if (Keyboard.GetState().IsKeyDown(Keys.Space))
         {
             if (bullet.timer == 0)
             {
                 bullet          = new bullet(fire_ball, Mariostate.Position, content, Mariostate.Direction, -1);
                 bullet.released = true;
                 content.Load <SoundEffect>("FireBall").Play();
             }
         }
         if (bullet.released == true)
         {
             bullet.Update(gameTime);
         }
     }
 }
Пример #2
0
 public Mario(ContentManager Content, Vector2 Position)
 {
     num_coins            = 0;
     Lives                = 30;
     Bounds               = new Rectangle((int)Position.X, (int)Position.Y, 35, 40);
     Mariostate           = new MarioSmall(Content, Position, 35, 40);
     Mariostate.Vibrating = false;
     TransformingTime     = 0;
     bullet               = new bullet(Content.Load <Texture2D>("Ball"), Position, Content, Mariostate.Direction, -1);
     fire_ball            = Content.Load <Texture2D>("Ball");
     content              = Content;
 }