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