コード例 #1
0
        public void Add(float x, float y, Color color, float scale = 0.5f)
        {
            //drop a piece of junk
            var droppedJunk = new RandomDebris();

            droppedJunk.Position = new MovementBehaviour()
            {
                X = x,
                Y = y,
            };
            droppedJunk.Scale = new Vector2(scale, scale);
            droppedJunk.Color = color;
            droppedJunk.ChangeDebrisFrame(100);
            RandomDebris.Add(droppedJunk);
            Sheet.SpriteSheetRectangle.Add(RandomDebris.Count.ToString(), new Rectangle(droppedJunk.FramePosition.ToPoint(), new Point(32)));
        }
コード例 #2
0
        public override void Initialize()
        {
            var frames = new Dictionary <string, Rectangle>();

            for (int i = 0; i < DebrisCount; i++)
            {
                var randomDebris = new RandomDebris();
                RandomDebris.Add(randomDebris);
                frames.Add(i.ToString(), new Rectangle(randomDebris.FramePosition.ToPoint(), new Point(32)));
            }
            Sheet = new SpriteSheet(frames)
            {
                Path = "Image/debris"
            };
            Add(new AsteroidScreenBehaviour(Sheet));
            base.Initialize();
        }