コード例 #1
0
ファイル: TestScene.cs プロジェクト: jsysnowy/MonoGameV2
        /// <summary>
        /// Creates this scene.
        /// </summary>
        public TestScene()
        {
            ActiveCamera.Zoom = 1f;

            ///Temp BG image, switch with TileSprites.
            Background = new GameObject();
            Background.AddModule <TileMap>().MapID = "BattleMap";
            Add(Background);


            // Test sprite for Spritesheets
            _raptor = new Components.Raptor();
            Add(_raptor);



            Random rnd = new Random();

            for (int i = 0; i < 500; i++)
            {
                GameObject rndp = new GameObject();
                rndp.WorldPosition.X = (float)rnd.NextDouble() * 2000;
                rndp.WorldPosition.Y = (float)rnd.NextDouble() * 2000;
                SpritesheetTexture tex = rndp.AddModule <SpritesheetTexture>();
                tex.TextureID  = "phoenix";
                tex.StartIndex = 0;
                tex.EndIndex   = 3;
                tex.Enable();
                //Phoenix.AddModule<GRIDController>();
                rndp.AddModule <CustomRectHitArea>().SetBounds(new Rectangle(0, 0, 12, 12));
                Add(rndp);
            }
        }
コード例 #2
0
ファイル: Raptor.cs プロジェクト: jsysnowy/MonoGameV2
        /// <summary>
        /// Create a new instance of raptor
        /// </summary>
        public Raptor()
        {
            // Setup controller:
            _controller = this.AddModule <GRIDController>();

            // Setup texture:
            _texture           = this.AddModule <SpritesheetTexture>();
            _texture.TextureID = "Raptor";

            // Setup collision box:
            _collisionBox = this.AddModule <CustomRectHitArea>();
            _collisionBox.SetBounds(new Rectangle(0, 0, 100, 100));
        }