コード例 #1
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);
                }
            }
コード例 #2
0
ファイル: GameEngine.cs プロジェクト: kjin/ribbon_gameplay
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            canvas.Reset();
            canvas.BeginSpritePass(BlendState.AlphaBlend);
            canvas.DrawSprite(background, Color.White, new Vector2(background.Width, background.Height) / scale / 2, Vector2.One / scale, 0);
            foreach (Object o in objects)
            {
                o.Draw(canvas);
            }
            canvas.EndSpritePass();

            base.Draw(gameTime);
        }
コード例 #3
0
ファイル: BoxObject.cs プロジェクト: kjin/ribbon_gameplay
 /// <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);
 }
コード例 #4
0
ファイル: BoxObject.cs プロジェクト: kjin/ribbon_gameplay
 /// <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);
 }
コード例 #5
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);
                }
        }