我得到了这本书:“用于十几岁的视觉c#游戏编程”(作者:Jonathan s.Harbour)。 它看起来很旧,事实上这段代码不起作用:
namespace RPG
{
public class Sprite
{
public Enum AnimateDir
{
NONE = 0,
FORWARD = 1,
BACKWARD = -1
}
public Enum AnimateWrap
{
WRAP = 0,
BOUNCE = 1
}
private Game p_game;
private PointF p_position;
private PointF p_velocity;
private Size p_size;
private Bitmap p_bitmap;
private bool p_alive;
private int p_columns;
private int p_totalFrames;
private int p_currentFrame;
private AnimateDir p_animationDir; //the error is here
private AnimateWrap p_animationWrap;//and here
private int p_lastTime;
private int p_animationRate;
public Sprite(ref Game game)
{
p_game = game;
p_position = new PointF(0, 0);
p_velocity = new PointF(0, 0);
p_size = new Size(0, 0);
p_bitmap = null;
p_alive = true;
p_columns = 1;
p_totalFrames = 1;
p_currentFrame = 0;
p_animationDir = AnimateDir.FORWARD;
p_animationWrap = AnimateWrap.WRAP;
p_lastTime = 0;
p_animationRate = 30;
}
}
}
代码继续(有关更多信息,数字图书为here 它说'WindowsFormApplication1.RPG.Sprite.AnimateDir'是'propriety'但是像'type'一样使用 同样的事情:“AnimateWrap”