【发布时间】:2012-01-31 00:32:29
【问题描述】:
我正在尝试在 3 秒内实时填充一个矩形
我希望增量是一个常数值,看起来不错并且没有加速度
我无法理解该怎么做
这是我的代码
// constant
// 1.0f = 100% of rectangle, 3 sec = 3000.0 miliseconds
float addValue = 1.0f/3000.0f;
public override void Update(GameTime gameTime)
{
newGameTime += gameTime.ElapsedGameTime.Milliseconds;
// once the percentage is set to 0 this starts
if ((percentage < 1))
{
// calculate value here in order to time
percentage += addValue;
}
}
我一直在尝试各种疯狂的数学来让它正确,但我完全失去了它。 :( 我知道我应该使用 gameTime 或 newGameTime 但我迷路了
【问题讨论】: