示例#1
0
        public StageComponent(Game game,
                              SpriteBatch spriteBatch,
                              Texture2D stage,
                              PlatformMetal platform
                              )
            : base(game)
        {
            this.spriteBatch = spriteBatch;
            this.stage       = stage;
            this.platform    = platform;


            position = new Vector2(-20, 0);
        }
示例#2
0
        public Mission1(Game game, SpriteBatch spriteBatch) : base(game)
        {
            this.spriteBatch = spriteBatch;
            stage            = new Stage(game, spriteBatch);
            cobra            = new Characters.Cobra(game, spriteBatch);
            cDetect          = new MerlinsQuest.CollisionDetection(game, spriteBatch);


            Texture2D platTex1 = game.Content.Load <Texture2D>("images/metal");
            Texture2D platTex2 = game.Content.Load <Texture2D>("images/metal");
            Texture2D platTex3 = game.Content.Load <Texture2D>("images/metal");
            Texture2D platTex4 = game.Content.Load <Texture2D>("images/metal");

            //platforms
            metal1 = new PlatformMetal(game, spriteBatch, platTex1);
            metal1.PlatComp.position = new Vector2(400, 500 + metal1.PlatComp.platTex.Height + cobra.cobraStandingRightSide.Height);
            metal2 = new PlatformMetal(game, spriteBatch, platTex2);
            metal2.PlatComp.position = new Vector2(1000, 500 + metal2.PlatComp.platTex.Height + cobra.cobraStandingRightSide.Height);
            metal3 = new PlatformMetal(game, spriteBatch, platTex2);
            metal3.PlatComp.position = new Vector2(1400, 500 + metal3.PlatComp.platTex.Height + cobra.cobraStandingRightSide.Height);
            metal4 = new PlatformMetal(game, spriteBatch, platTex2);
            metal4.PlatComp.position = new Vector2(1800, 500 + metal4.PlatComp.platTex.Height + cobra.cobraStandingRightSide.Height);

            metPlats.Add(metal1);
            metPlats.Add(metal2);
            metPlats.Add(metal3);
            metPlats.Add(metal4);
            //fonts


            cobra.currentTexture = cobra.cobraStandingRightSide;


            //add
            this.Components.Add(stage);
            this.Components.Add(metal1);
            this.Components.Add(metal2);
            this.Components.Add(metal3);
            this.Components.Add(metal4);
            this.Components.Add(cobra);


            //show
            stage.show();
            metal1.show();
            metal2.show();
            metal3.show();
            metal4.show();
        }