Ejemplo n.º 1
0
 public LinearEnemyBullet(double x, double y, Vector2 force)
     : base(x, y)
 {
     Width  = 7;
     Height = 7;
     Force  = force;
     Sprite = new RectangleSprite(Color.Cyan);
 }
Ejemplo n.º 2
0
        public override void Start()
        {
            base.Start();
            Display = DisplayDefault;

            SpriteComponent = new RectangleSprite(Size, Color.Green, Color.Transparent, 0, 5);
            SpriteObject.Components.Add(SpriteComponent);
            GameObject.Children.Add(SpriteObject);
        }
Ejemplo n.º 3
0
        public SimpleBorder(Func <GraphicsDevice> graphicsDeviceFunc)
        {
            Visible = true;

            SceneNode        = new SceneNode();
            Motion           = new Motion(SceneNode);
            _rectangleSprite = new RectangleSprite(graphicsDeviceFunc);

            Color     = Color.Black;
            Thickness = 1;

            SceneNode.DepthChanged += OnSceneNodeDepthChanged;
        }
        public void Draw(SpriteBatch spritebatch)
        {
            spritebatch.Begin();

            switch (level)
            {
            case 0: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Red, 5); break;

            case 1: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Blue, 5); break;

            case 2: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.LimeGreen, 5); break;

            case 3: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Orange, 5); break;

            case 4: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Purple, 5); break;
            }

            spritebatch.End();
        }
Ejemplo n.º 5
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public TestPrimitivesScreenView(Screen screen) : base(screen)
        {
            HorizontalLine = new Line(Vector2.One, Color.White, 1)
            {
                Parent    = Container,
                Alignment = Alignment.TopCenter,
                Alpha     = 0.5f,
                X         = -250,
                Y         = 30
            };

            HorizontalLine.EndPosition = new Vector2(HorizontalLine.AbsolutePosition.X + 500, HorizontalLine.AbsolutePosition.Y);

            Rect = new RectangleSprite(2)
            {
                Parent    = Container,
                Alignment = Alignment.TopCenter,
                Y         = 55,
                Size      = new ScalableVector2(50, 20),
                X         = -25
            };

            FilledRect = new FilledRectangleSprite()
            {
                Parent    = Container,
                Alignment = Alignment.TopCenter,
                Position  = new ScalableVector2(-50, Rect.Y + Rect.Height + 5),
                Size      = new ScalableVector2(100, 30)
            };

            PrimitiveLineBatch = new PrimitiveLineBatch(new List <Vector2>()
            {
                new Vector2(0, 100),
                new Vector2(100, 100),
                new Vector2(100, 0),
                new Vector2(0, 100)
            }, 3)
            {
                Parent    = Container,
                Alignment = Alignment.MidCenter,
            };
        }
        public void Draw(SpriteBatch spritebatch, Matrix CameraMatrix)
        {
            spritebatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, CameraMatrix);


            switch (level)
            {
            case 0: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Red, 5); break;

            case 1: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Blue, 5); break;

            case 2: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.LimeGreen, 5); break;

            case 3: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Orange, 5); break;

            case 4: RectangleSprite.DrawRectangle(spritebatch, bounds, Color.Purple, 5); break;
            }

            spritebatch.End();
        }
Ejemplo n.º 7
0
        public Backdrop()
        {
            Transform transform = GetComponent <Transform>();

            Constants.SetLayerDepth(this, Constants.LayerDepth.Backdrop);

            // get initial position at top of screen
            var viewport = Game1.viewport.Bounds;

            //transform.position.Y = -viewport.Height;// - Level.screen_height;
            transform.position.Y = -viewport.Height + (viewport.Height - Level.screen_height);

            // Blue boxes
            RectangleSprite smallBlueBox = new RectangleSprite(Color.Blue, new Rectangle(236, 173, 101, 104));

            AddComponent(smallBlueBox);
            RectangleSprite bigBlueBox = new RectangleSprite(Color.Blue, new Rectangle(492, 173, 388, 171));

            AddComponent(bigBlueBox);
            RectangleSprite itemBBlueBox = new RectangleSprite(Color.Blue, new Rectangle(492, 801, 69, 105));

            AddComponent(itemBBlueBox);
            RectangleSprite itemABlueBox = new RectangleSprite(Color.Blue, new Rectangle(588, 801, 69, 105));

            AddComponent(itemABlueBox);

            Texture2D blackRectangle = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);

            blackRectangle.SetData(new[] { Color.Black });
            List <Rectangle> frames = new List <Rectangle>()
            {
                new Rectangle(
                    0,
                    0,
                    (int)(viewport.Width / Constants.SPRITE_SCALAR),
                    (int)(viewport.Height / Constants.SPRITE_SCALAR + Constants.SCREEN_HEIGHT_OFFSET)
                    ),
            };
            Sprite sprite = new Sprite(new BasicSprite(blackRectangle, frames));

            AddComponent(sprite);

            AddComponent(new BackdropBehavior());

            float             textScale  = 0.5f;
            int               xOffset    = 18;
            int               yOffset    = 18;
            int               itemOffset = 32;
            List <TextEntity> texts      = new List <TextEntity>()
            {
                new TextEntity(new Vector2(137, 92), "Inventory", Color.Red, textScale),
                new TextEntity(new Vector2(63, 292), "Use B Button", Color.White, textScale),
                new TextEntity(new Vector2(127, 326), "For This", Color.White, textScale),
                new TextEntity(new Vector2(159, 392), "Map", Color.Red, textScale),
                new TextEntity(new Vector2(96, 556), "Compass", Color.Red, textScale),
                new TextEntity(new Vector2(68, 720), "Level-1", Color.White, textScale),
                new TextEntity(new Vector2(733, 785), "- Life -", Color.Red, textScale),
                new TextEntity(new Vector2(492 + xOffset, 801 - yOffset), "B", Color.White, textScale),
                new TextEntity(new Vector2(588 + xOffset, 801 - yOffset), "A", Color.White, textScale),
                new TextEntity(new Vector2(680, 720), "XP:", Color.Green, textScale),
                new TextEntity(new Vector2(885, 720), "/", Color.Green, textScale),
                new TextEntity(new Vector2(920, 720), Constants.MAX_XP.ToString(), Color.Green, textScale),
                new HUDTextRupee(new Vector2(400, 801 - yOffset), "X", Color.White, textScale),
                new HUDTextKey(new Vector2(400, 801 - yOffset + itemOffset * 2), "X", Color.White, textScale),
                new HUDTextBomb(new Vector2(400, 801 - yOffset + itemOffset * 3), "X", Color.White, textScale),
                // boss rush only
                new HUDTextBossRush(new Vector2(68, 790), "X", Color.White, textScale)
            };

            foreach (var t in texts)
            {
                transform.AddChild(t);
                Scene.Add(t);
            }

            // ToDo: add a "Manual" Sprite drawing mode so I can add the blue lines.
            List <Entity> sprites = new List <Entity>()
            {
                new HUDItem(HUDSpriteFactory.Instance.CreateHUDRupee(), new Vector2(350, 801 - yOffset)),
                new HUDItem(HUDSpriteFactory.Instance.CreateHUDKey(), new Vector2(350, 801 - yOffset + itemOffset * 2)),
                new HUDItem(HUDSpriteFactory.Instance.CreateHUDBomb(), new Vector2(350, 801 - yOffset + itemOffset * 3)),
                new HUDMap(new Vector2(191, 440)),
                new HUDCompass(new Vector2(175, 600)),
                new HUDItem(HUDSpriteFactory.Instance.CreateBoomerang(), new Vector2(524, 189), Constants.HUD_BOOMERANG_SCALE),
                new HUDItem(HUDSpriteFactory.Instance.CreateBomb(), new Vector2(600, 189), Constants.HUD_BOMB_SCALE),
                Bow,
                new SelectedItem(new Vector2(260, 181)),
                new ItemSelector(ItemSelectorPositions[CurrentItemSelectorIndex]),
                new SelectedItem(new Vector2(500, 820)),
                new SelectedWeapon(new Vector2(607, 825))
            };

            foreach (var s in sprites)
            {
                transform.AddChild(s);
                Scene.Add(s);
            }

            // Hearts
            var hearts = new List <Heart>();

            AddComponent(new HeartDisplayManager(hearts, new Vector2(710, 880), this));

            // Xp
            AddComponent(new XPDisplayManager(new Vector2(780, 15)));

            // Map
            var map = new Map();

            transform.AddChild(map);

            Minimap = new Minimap(new Vector2(68, 776), false);
            transform.AddChild(Minimap);
        }