Пример #1
0
        public PlatformObject(World world, Vector2 position)
        {
            // because it's a TetrisObject we get the size and texture from the TetrisSet
            Vector2   size    = TetrisSet.getSize(TetrisSet.Type.Tfloor);
            Texture2D texture = TetrisSet.getTexture(TetrisSet.Type.Tfloor);

            // create the real item
            platform               = new DrawablePhysicsObject(world, texture, size, mass);
            platform.Position      = position;
            platform.body.BodyType = bodyType;
        }
Пример #2
0
        public void LoadContent(ContentManager content)
        {
            TetrisSet.LoadContent(content);

            font = content.Load <SpriteFont>("font");

            foreach (PlayField playfield in playfields)
            {
                playfield.LoadContent(content);
            }
        }
Пример #3
0
        public TetrisObject(World world, TetrisSet.Type type, Vector2 position, float rotation)
        {
            // because it's a TetrisObject we get the size and texture from the TetrisSet
            Vector2   size    = TetrisSet.getSize(type);
            Texture2D texture = TetrisSet.getTexture(type);

            // create the real block
            block                  = new DrawablePhysicsObject(world, texture, size, mass);
            block.Position         = position;
            block.body.Rotation    = rotation;
            block.body.Friction    = friction;
            block.body.Restitution = restitution;
            block.body.BodyType    = bodyType;
        }
Пример #4
0
        public void Initialize()
        {
            TetrisSet.Initialize();

            var applicationView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();

            windowHeight = Convert.ToInt32(applicationView.VisibleBounds.Height);
            windowWidth  = Convert.ToInt32(applicationView.VisibleBounds.Width);

            playfields = new ArrayList();

            for (int i = 0; i < playFieldAmount; ++i)
            {
                Vector2 position = new Vector2(windowWidth / playFieldAmount * i, 0);
                Vector2 size     = new Vector2(windowWidth / playFieldAmount, windowHeight);

                PlayField playfield = new PlayField();
                playfield.Initialize(position, size);

                playfields.Add(playfield);
            }
        }