Ignore:
Timestamp:
02/09/2012 06:00:07 PM (3 years ago)
Author:
acarter
Message:

Rebuilding with error handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Code/oMaE/oMaE/MiniGames/Match.cs

    r24 r32  
    3434            children.Add(new Button(new Rectangle(800, 400, 75, 20), "Check").addButtonListener(this));
    3535            children.Add(new Button(new Rectangle(800, 450, 75, 20), "Back").addButtonListener(this));
     36            children.Add(new Image2D("Sprites/drum", new Rectangle(310, 20, 100, 100)));
     37            children.Add(new Image2D("Sprites/microphone", new Rectangle(325, 170, 50, 100)));
     38            children.Add(new Image2D("Sprites/speaker", new Rectangle(300, 320, 100, 100)));
    3639            return base.Initialize();
    37         }
    38         public override bool LoadContent(ContentManager Content)
    39         {
    40             if(Drum == null)
    41                 Drum = Content.Load<Texture2D>("Sprites/drum");
    42             if (Microphone == null)
    43                 Microphone = Content.Load<Texture2D>("Sprites/microphone");
    44             if (Speaker == null)
    45                 Speaker = Content.Load<Texture2D>("Sprites/speaker");
    46             return base.LoadContent(Content);
    47         }
    48         public override void Draw(SpriteBatch sb, GameState gamestate)
    49         {
    50             Color fontColor = Color.Black;
    51             sb.Begin();
    52             for (int i = 0; i < energies.Length; ++i)
    53             {
    54                 sb.DrawString(Font, energies[i], new Vector2(20 + offset[i], 40 * i + 100), fontColor);
    55                 sb.DrawString(Font, energies[i], new Vector2(600, 40 * i + 100), fontColor);
    56             }
    57             sb.Draw(Drum, new Rectangle(310, 20, 100, 100), Color.White);
    58             sb.Draw(Microphone, new Rectangle(325, 170, 50, 100), Color.White);
    59             sb.Draw(Speaker, new Rectangle(300, 320, 100, 100), Color.White);
    60             sb.End();
    61             base.Draw(sb, gamestate);
    6240        }
    6341        public void ButtonUpdated(Button button)
Note: See TracChangeset for help on using the changeset viewer.