/// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            LineBatch = new LineBatch(GraphicsDevice);
            Assets = new AssetCreator(GraphicsDevice);
            Assets.LoadContent(Content);
            _input.LoadContent();

            // Tell each of the screens to load their content.
            foreach (GameScreen screen in _screens)
            {
                screen.LoadContent();
            }
        }
Exemplo n.º 2
0
        private void CreateChassis(World world, Vector2 pivot, AssetCreator assets)
        {
            {
                PolygonShape shape = new PolygonShape(1f);
                shape.Vertices = PolygonTools.CreateRectangle(2.5f, 1.0f);

                _body = new Sprite(assets.TextureFromShape(shape, MaterialType.Blank, Color.Beige, 1f));

                _chassis = BodyFactory.CreateBody(world);
                _chassis.BodyType = BodyType.Dynamic;
                _chassis.Position = pivot + _position;

                Fixture fixture = _chassis.CreateFixture(shape);
                fixture.CollisionGroup = -1;
            }

            {
                CircleShape shape = new CircleShape(1.6f, 1f);
                _engine = new Sprite(assets.TextureFromShape(shape, MaterialType.Waves, Color.Beige * 0.8f, 1f));

                _wheel = BodyFactory.CreateBody(world);
                _wheel.BodyType = BodyType.Dynamic;
                _wheel.Position = pivot + _position;

                Fixture fixture = _wheel.CreateFixture(shape);
                fixture.CollisionGroup = -1;
            }

            {
                _motorJoint = new RevoluteJoint(_wheel, _chassis, _wheel.GetLocalPoint(_chassis.Position), Vector2.Zero);
                _motorJoint.CollideConnected = false;
                _motorJoint.MotorSpeed = _motorSpeed;
                _motorJoint.MaxMotorTorque = 400f;
                _motorJoint.MotorEnabled = true;
                world.AddJoint(_motorJoint);
            }
        }
Exemplo n.º 3
0
        private void CreateGFX(AssetCreator assets)
        {
            _face = new Sprite(assets.CircleTexture(0.9f, MaterialType.Squares, Color.Gray, 1f));
            _torso = new Sprite(assets.TextureFromVertices(PolygonTools.CreateRoundedRectangle(2f, 4f, 0.5f, 0.7f, 2), MaterialType.Squares, Color.LightSlateGray, 0.8f));

            _upperArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DimGray, 0.8f));
            _lowerArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f));

            _upperLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DimGray, 0.8f));
            _lowerLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f));
        }
Exemplo n.º 4
0
        private void CreateLegTextures(AssetCreator assets)
        {
            Vector2 p1 = new Vector2(-5.4f, 6.1f);
            Vector2 p2 = new Vector2(-7.2f, 1.2f);
            Vector2 p3 = new Vector2(-4.3f, 1.9f);
            Vector2 p4 = new Vector2(-2.9f, -0.7f);
            Vector2 p5 = new Vector2(0.6f, -2.9f);

            Vertices vertices = new Vertices(3);

            vertices.Add(p1);
            vertices.Add(p2);
            vertices.Add(p3);
            _leftLeg = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.IndianRed * 0.8f, 1f));

            vertices[0] = Vector2.Zero;
            vertices[1] = p4;
            vertices[2] = p5;
            _leftShoulder = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.Beige * 0.8f, 1f));

            p1.X *= -1f;
            p2.X *= -1f;
            p3.X *= -1f;
            p4.X *= -1f;
            p5.X *= -1f;

            vertices[0] = p1;
            vertices[1] = p3;
            vertices[2] = p2;
            _rightLeg = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.IndianRed * 0.8f, 1f));

            vertices[0] = Vector2.Zero;
            vertices[1] = p5;
            vertices[2] = p4;
            _rightShoulder = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.Beige * 0.8f, 1f));
        }
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _lineBatch = new LineBatch(GraphicsDevice);
            _assetCreator = new AssetCreator(GraphicsDevice);
            _assetCreator.LoadContent(_contentManager);
            _input.LoadContent();

            // Tell each of the screens to load their content.
            foreach (GameScreen screen in _screens)
            {
                screen.LoadContent();
            }
        }