コード例 #1
0
        public Game_object_Manager(Texture2D sheet_tex, Vector2 pos, GraphicsDevice graphics, Texture2D road_tex, UI_Handle ui)
        {
            this.graphics = graphics;
            this.sheet_tex = sheet_tex;
            this.pos = pos;
            this.road_tex = road_tex;
            this.ui = ui;

            //Calls method
            Create_level();
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: Nerminkrus/Spel
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Loads textures
            title_bkg = Content.Load<Texture2D>(@"Textures\bkg2");
            help_bkg = Content.Load<Texture2D>(@"Textures\help_bkg1");
            gameover_bkg = Content.Load<Texture2D>(@"Textures\go1");
            winning_bkg = Content.Load<Texture2D>(@"Textures\fullscreen_bkg2");
            sheet_tex = Content.Load<Texture2D>(@"Textures\Spritesheet1");
            road_tex = Content.Load<Texture2D>(@"Textures\road");
            grass_tex = Content.Load<Texture2D>(@"Textures\grass");

            //Particle Manager textures
            p_textures = new List<Texture2D>();
            p_textures.Add(Content.Load<Texture2D>(@"Textures\exp0"));
            p_textures.Add(Content.Load<Texture2D>(@"Textures\exp1"));
            p_textures.Add(Content.Load<Texture2D>(@"Textures\exp3"));

            //Loads sounds and music
            title_song = Content.Load<Song>(@"Sounds\td");
            in_game = Content.Load<Song>(@"Sounds\td_ingame");
            explosion = Content.Load<SoundEffect>(@"Sounds\118-Fire02");

            //Create instances of objects
            play_btn = new Button(sheet_tex, new Vector2(220, 250), new Rectangle(0,79, 328, 46));
            help_btn = new Button(sheet_tex, new Vector2(215, 350), new Rectangle(0, 124, 350, 48));
            back_btn = new Button(sheet_tex, new Vector2(1050, 660), new Rectangle(295, 174, 200, 48));
            exit_btn = new Button(sheet_tex, new Vector2(250, 450), new Rectangle(0, 171, 288, 48));
            restart_btn = new Button(sheet_tex, new Vector2(250, 560), new Rectangle(0, 780, 288, 150));
            ui = new UI_Handle(sheet_tex, new Vector2(1070, 0));
            go_manager = new Game_object_Manager(sheet_tex, Vector2.Zero, GraphicsDevice, road_tex, ui);

            //Loads fonts
            Font = Content.Load<SpriteFont>("font");

            //Starts playing music and sets different bools for it
            MediaPlayer.Play(title_song);
            MediaPlayer.IsRepeating = true;

            current_state = Game_state.title;
        }