예제 #1
0
파일: Game1.cs 프로젝트: Xeiphyer/TDGame
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            tower1 = new TowerButton(830, 220);
            //tower1.scale = 0.5f;
            
            Back1 = new sprite();
            Back1.Scale = 2.0f;
            graphics.PreferredBackBufferWidth = 1000;//size of window
            graphics.PreferredBackBufferHeight = 600;
            graphics.ApplyChanges();

            sidebar = new sprite();
            topbar = new sprite();

            title = new sprite();
            map = new sprite();

            lvl1Button = new Button();

            start = new Button();

            lvl1 = new Level1();

            lvl2Button = new Button();
            lvl2 = new Level2();

            base.Initialize();

        }
예제 #2
0
        public void create_main_screen_objects()
        {
            x                          = -50;
            y                          = 380;
            level_number               = 0;
            level_name                 = new string[no_of_level];
            this.buttonlist            = new List <Menu_button>();
            this.level_buttonlist      = new List <Menu_button>();
            this.next_level_buttonlist = new List <Menu_button>();
            this.restart_buttonlist    = new List <Menu_button>();

            for (int i = 0; i < no_of_level; i++)
            {
                level_name[i] = "images\\level" + i.ToString();
            }

            soundEngine = Content.Load <SoundEffect>("Audios\\theme");

            mm = new Main_menu();

            ourMouse    = new Mouse_Handler(Content);
            help_screen = false;

            catch_bag_l1 = new Level1(Content);
            l1_final     = new Level1_final(Content);
            l1_instr     = new Level1_instruction();
            last_screen  = new Last_screen(Content);
            button_click = Content.Load <SoundEffect>("Audios\\button");
        }
예제 #3
0
파일: Game1.cs 프로젝트: Xeiphyer/TDGame
 private void updateTarget(Level1 level)//I think the problem is the positions of the rectangles, I wish I could see them to test...
 {
     Rectangle rect1;
     Rectangle rect2;
     List<Tower> towers = tower1.getTowers();
     List<Pcrane> flock = level.getCranes();//this will have to be changes based on level, returns the cranes currently onscreen
     
     for (int i = 0; i < towers.Count; i++)
     {
         //rect1 = new Rectangle((int)towers[i].getPosition().X, (int)towers[i].getPosition().Y, 700, 700);
         rect1 = towers[i].getRange(); //think this is working now
         for (int j = 0; j < flock.Count; j++)
         {
             rect2 = new Rectangle((int)flock[j].getPosition().X, (int)flock[j].getPosition().Y, 70, 70);
             //rect2 = flock[j].getRec(); //this is wrong too
             if (towers[i].getTarget() == null && rect1.Intersects(rect2))
             {
                 //Tbutton.setTarget(flock[j]);
                 towers[i].setTarget(flock[j]); //woooo it works!
             }
         }
     }
 }