コード例 #1
0
ファイル: Ship.cs プロジェクト: smack0007/Snowball_v1
        public void LoadContent(IContentManager<DemoGameContent> contentManager)
        {
            this.sprite = new Sprite(contentManager.Load<SpriteSheet>(DemoGameContent.Ship));
            this.sprite.Frame = 1;
            this.sprite.Origin = new Vector2(40, 40);

            this.sprite.AddChild(new Sprite(contentManager.Load<SpriteSheet>(DemoGameContent.ShipFlame)));
            this.sprite.Children[0].Frame = 0;
            this.sprite.Children[0].Origin = new Vector2(8, 8);
            this.sprite.Children[0].Position = new Vector2(40, 88);

            this.blasterSoundEffect = contentManager.Load<SoundEffect>(DemoGameContent.Blaster);
        }
コード例 #2
0
        protected override void Initialize()
        {
            this.graphicsDevice.CreateDevice(800, 600);

            // GraphicsBatch must be created after the graphics device is created.
            this.graphics = new GraphicsBatch(this.graphicsDevice);

            this.animationOffset = 1;

            // Load a texture and wrap it in a SpriteSheet. The sheet contains frames which are 32x32.
            SpriteSheet spriteSheet = this.content.Load<SpriteSheet>(new LoadSpriteSheetArgs()
            {
                FileName = "wizard.png",
                FrameWidth = 32,
                FrameHeight = 32
            });

            this.sprite = new Sprite(spriteSheet);
            this.sprite.Position = new Vector2(this.Window.DisplayWidth / 2, this.Window.DisplayHeight / 2);
            this.sprite.Origin = new Vector2(16, 16);
        }
コード例 #3
0
ファイル: Sprite.cs プロジェクト: smack0007/Snowball_v1
        public void AddChild(Sprite sprite)
        {
            if (sprite == null)
                throw new ArgumentNullException("sprite");

            this.children.Add(sprite);
        }