小编mra*_*guy的帖子

XNA 2D相机 - 如何将其锁定/居中到动画精灵?

嘿我正试图让我的相机跟着我的精灵,由于某种原因,精灵总是比我的相机移动得更快,我的相机无法夹到屏幕上.我想这样做,以便摄像机始终以精灵为中心,并在他移动时跟随他.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace wintertermrpg
{
    public class AnimatedSprite
    {
        public enum Facing
        {
            Left,
            Right,
            Up,
            Down
        }
        public Facing facingDirection;

        public Dictionary<string, FrameAnimation> Animations = new Dictionary<string,     FrameAnimation>();
        Camera cam = new Camera();
        public Vector2 Position = Vector2.Zero;
        Texture2D texture;
        public bool IsCharacter = false;
        public bool isAnimating = true;
        string animationName = null;
        float speed = 2f;

        public float Speed
        {
            get { return speed; …
Run Code Online (Sandbox Code Playgroud)

c# xna camera sprite

2
推荐指数
1
解决办法
7355
查看次数

标签 统计

c# ×1

camera ×1

sprite ×1

xna ×1