Ejemplo n.º 1
0
 /// <summary>
 ///  Constructor to create a new instance of our game.
 /// </summary>
 public GameEngine()
 {
     // Tell the program to load all files relative to the "Content" directory.
     content = new ContentManager(Services);
     content.RootDirectory = "Content";
     canvas = new GameCanvas(this);
 }
Ejemplo n.º 2
0
 public override void Draw(GameCanvas g)
 {
     foreach (BoxObject link in bodies)
     {
         link.Draw(g);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Draws the physics object.
 /// </summary>
 /// <remarks>
 /// This is sufficient for most complex objects.
 /// </remarks>
 /// <param name="canvas">Drawing context</param>
 public override void Draw(GameCanvas canvas)
 {
     // Just pass the drawing to the individual objects.
     foreach (BoxObject obj in bodies)
     {
         obj.Draw(canvas);
     }
 }
Ejemplo n.º 4
0
        public void Draw(GameCanvas g)
        {
            for (int i = 0; i < points.Count - 1; i++)
            {
                g.DrawLine(points[i], points[i + 1], Color.Red);
            }

            box.Draw(g);
            box2.Draw(g);
        }
Ejemplo n.º 5
0
        public void Draw(GameCanvas g)
        {
            for (int i = 0; i < points.Count - 1; i++)
            {
                g.DrawLine(points[i], points[i + 1], Color.Red);
            }

            box.Draw(g);
            box2.Draw(g);
        }
Ejemplo n.º 6
0
            public override void Draw(GameCanvas g)
            {
                SpriteEffects flip = facingRight ? SpriteEffects.None : SpriteEffects.FlipHorizontally;

                // Determine what to draw, then do it
                if (isGrounded && body.LinearVelocity.Length() > 0.1f)
                {
                    texture = walking;
                    g.DrawSprite(texture, Color.White, Position, scale, rotation, frame, MAX_FRAME, flip);
                }
                else
                {
                    texture = standing;
                    if (body.LinearVelocity.Y < 0.0f) texture = jumping;
                    if (body.LinearVelocity.Y > 0.0f) texture = falling;

                    g.DrawSprite(texture, Color.White, Position, scale, rotation, flip);
                }
            }
Ejemplo n.º 7
0
 /// <summary>
 /// Draws the physics object.
 /// </summary>
 /// <remarks>
 /// This is sufficient for most complex objects.
 /// </remarks>
 /// <param name="canvas">Drawing context</param>
 public override void Draw(GameCanvas canvas)
 {
     // Just pass the drawing to the individual objects.
     foreach (BoxObject obj in bodies)
     {
         obj.Draw(canvas);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Draws the physics object.
 /// </summary>
 /// <param name="canvas">Drawing context</param>
 public virtual void Draw(GameCanvas g)
 {
     g.DrawSprite(texture, Color.White, Position, scale, rotation);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Draws the physics object.
 /// </summary>
 /// <param name="canvas">Drawing context</param>
 public abstract void Draw(GameCanvas canvas);
Ejemplo n.º 10
0
 /// <summary>
 /// Draws the physics object.
 /// </summary>
 /// <param name="canvas">Drawing context</param>
 public abstract void Draw(GameCanvas canvas);
Ejemplo n.º 11
0
 /// <summary>
 /// Draws the physics object.
 /// </summary>
 /// <param name="canvas">Drawing context</param>
 public virtual void Draw(GameCanvas g)
 {
     g.DrawSprite(texture, Color.White, Position, scale, rotation);
 }
Ejemplo n.º 12
0
 /// <summary>
 ///  Constructor to create a new instance of our game.
 /// </summary>
 public GameEngine()
 {
     // Tell the program to load all files relative to the "Content" directory.
         content = new ContentManager(Services);
         content.RootDirectory = "Content";
         canvas = new GameCanvas(this);
 }
Ejemplo n.º 13
0
        public override void Draw(GameCanvas g)
        {
            SpriteEffects flip = facingRight ? SpriteEffects.None : SpriteEffects.FlipHorizontally;

                // Determine what to draw, then do it
                if (isGrounded && body.LinearVelocity.Length() > 0.1f)
                {
                    texture = walking;
                    g.DrawSprite(texture, Color.White, Position, scale, rotation, frame, MAX_FRAME, flip);
                }
                else
                {
                    texture = standing;
                    if (body.LinearVelocity.Y < 0.0f) texture = jumping;
                    if (body.LinearVelocity.Y > 0.0f) texture = falling;

                    g.DrawSprite(texture, Color.White, Position, scale, rotation, flip);
                }
        }
Ejemplo n.º 14
0
 public override void Draw(GameCanvas g)
 {
     foreach (BoxObject link in bodies)
     {
         link.Draw(g);
     }
 }